Class Iterator

A lazy collection iterator yields a single value at a time upon request.

Constructors

  • Parameters

    • source: Source

      An iterable object or function. Array - return one element per cycle Object{next:Function} - call next() for the next value (this also handles generator functions) Function - call to return the next value

    Returns Iterator

Properties

#getNext: Callback<IteratorResult<unknown>, boolean>
#iteratees: Iteratee[] = []
#yieldedValues: unknown[] = []
isDone: boolean = false

Methods

  • Drop a number of values from the sequence

    Parameters

    • n: number

      Number of items to drop greater than 0

    Returns Iterator

  • Execute the funcion for each value. Will stop when an execution returns false.

    Type Parameters

    • T = unknown

    Parameters

    Returns boolean

    false iff f return false for AnyVal execution, otherwise true

  • Returns the reduction of sequence according the reducing function

    Type Parameters

    • T = unknown

    Parameters

    • f: Callback<T, unknown>

      a reducing function

    • Optional initialValue: unknown

    Returns T

  • Returns the number of matched items in the sequence

    Returns number

  • Returns a new lazy object with results of the transformation The entire sequence is realized.

    Parameters

    • fn: Callback<Source, unknown[]>

      Tranform function of type (Array) => (Any)

    Returns Iterator

  • Returns the fully realized values of the iterators. The return value will be an array unless lazy.first() was used. The realized values are cached for subsequent calls.

    Type Parameters

    • T

    Returns T[]