Class AugmentedIterator<TValue, TReturn, TNext>Abstract

An AugmentedIterator represents one of the IterableIterators we return. This abstract class is exported only to provide type/intellisense information, and should be only implemented internally.

Type Parameters

  • TValue

  • TReturn = any

  • TNext = any

Hierarchy

  • AugmentedIterator

Implements

Constructors

Methods

Constructors

  • Type Parameters

    • TValue

    • TReturn = any

    • TNext = any

    Returns AugmentedIterator<TValue, TReturn, TNext>

Methods

  • Returns a new AugmentedIterator that will only yield values for which filter returns true

    Parameters

    • filter: ((item) => boolean)

      The filtering function you wish to use

        • (item): boolean
        • Parameters

          • item: TValue

          Returns boolean

    Returns AugmentedIterator<TValue, TReturn, TNext>

  • Returns a new AugmentedIterator that will run mapper over each item before yielding

    Because we return another AugmentedIterator instance, this call is chainable.

    Type Parameters

    • TMapperReturn

      the return type from mapper, will also become the new TValue type of the returned AugmentedIterator

    Parameters

    • mapper: ((item) => TMapperReturn)

      the mapping function you want to be run over all values

        • (item): TMapperReturn
        • Parameters

          • item: TValue

          Returns TMapperReturn

    Returns AugmentedIterator<TMapperReturn, TReturn, TNext>

  • Parameters

    • Rest ...args: [] | [TNext]

    Returns IteratorResult<TValue, TReturn>

  • Returns a new AugmentedIterator that has access to the last value yielded OR initial the same way a reduce would normally work over say an array.

    Type Parameters

    • TReducerReturn

      the return type of reducer, and of initial; will also become the TValue type of the returned AugmentedIterator

    Parameters

    • reducer: ((carry, item) => TReducerReturn)

      the function you want to use as a reducer. Takes arguments in (carry,item) order. The first time we yield a value carry will be initial, after which it will be the previously returned value from reducer.

        • (carry, item): TReducerReturn
        • Parameters

          • carry: TReducerReturn
          • item: TValue

          Returns TReducerReturn

    • initial: TReducerReturn

      the value we should pass to reducer the first time we yield a value.

    Returns AugmentedIterator<TReducerReturn, TReturn, TNext>

Generated using TypeDoc