@bodil/monkey-business
    Preparing search index...

    Interface IteratorObject<T, TReturn, TNext>

    Describes an Iterator produced by the runtime that inherits from the intrinsic Iterator.prototype.

    interface IteratorObject<T, TReturn = unknown, TNext = unknown> {
        equals<T = unknown, U = unknown>(
            value: Iterable<U>,
            equalsFn?: (a: T, b: U) => boolean,
        ): boolean;
        findMap<U>(
            mapFn: (value: T) => NonNullable<U> | undefined,
        ): NonNullable<U> | undefined;
        frontBiasedPartition(size: number): T[][];
        nonNullable(): IteratorObject<NonNullable<T>, undefined>;
        partition(size: number): IteratorObject<T[], undefined>;
        present(): IteratorObject<Present<T>, undefined>;
        skipWhile(
            predicate: (value: T, index: number) => boolean,
        ): IteratorObject<T, undefined>;
        takeOne(): Option<T>;
        takeWhile<S>(
            predicate: (value: T, index: number) => value is S,
        ): IteratorObject<S, undefined>;
    }

    Type Parameters

    • T
    • TReturn = unknown
    • TNext = unknown

    Hierarchy

    • Iterator<T, TReturn, TNext>
    • Disposable
      • IteratorObject

    Methods

    • Test whether the given Iterable has the same contents as this iterator.

      Note that this will consume this iterator up to the point where the values diverge. You should not rely on any particular state of the iterator afterwards, but consider it spent.

      Type Parameters

      • T = unknown
      • U = unknown

      Parameters

      • value: Iterable<U>
      • OptionalequalsFn: (a: T, b: U) => boolean

      Returns boolean

    • Iterate until calling mapFn on an item returns a value, then return that value. Return undefined if mapFn never returns a value.

      Type Parameters

      • U

      Parameters

      Returns NonNullable<U> | undefined

    • As IteratorObject#partition, but if the input length isn't divisible by size, ensure the first array is the shortest one rather than the last.

      Be warned that this requires the entire input iterable to be read up front to decide its length, so this function is not lazy.

      Parameters

      • size: number

      Returns T[][]

    • Ignore all items matching predicate until the first item that doesn't match.

      Parameters

      • predicate: (value: T, index: number) => boolean

      Returns IteratorObject<T, undefined>

    • Take items from the iterator only until the first time predicate returns false.

      Type Parameters

      • S

      Parameters

      • predicate: (value: T, index: number) => value is S

      Returns IteratorObject<S, undefined>