Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Iterator

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

Hierarchy

  • Iterator

Index

Constructors

constructor

  • 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

Private getNext

getNext: Callback<IteratorResult, unknown>

Private isDone

isDone: boolean = false

Private Readonly iteratees

iteratees: Iteratee[] = []

Private Readonly yieldedValues

yieldedValues: RawArray = []

Methods

[iterator]

drop

  • Drop a number of values from the sequence

    Parameters

    • n: number

      Number of items to drop greater than 0

    Returns Iterator

each

  • each<T>(f: Callback<T, unknown>): boolean
  • 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

filter

map

next

  • next(): IteratorResult

Private push

reduce

  • reduce<T>(f: Callback<T, unknown>, initialValue?: unknown): T
  • 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

size

  • size(): number
  • Returns the number of matched items in the sequence

    Returns number

take

  • Take given numbe for values from sequence

    Parameters

    • n: number

      A number greater than 0

    Returns Iterator

transform

  • 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

value

  • value(): unknown
  • 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

    Returns unknown

Generated using TypeDoc