Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MapIterator<T, U>

An iterator which transforms values using a mapping function.

Type parameters

  • T

  • U

Hierarchy

  • MapIterator

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

  • Construct a new map iterator.

    Parameters

    • source: IIterator<T>

      The iterator of values of interest.

    • fn: function

      The mapping function to invoke for each value.

        • (value: T, index: number): U
        • Parameters

          • value: T
          • index: number

          Returns U

    Returns MapIterator

Properties

Private _fn

_fn: function

Type declaration

    • (value: T, index: number): U
    • Parameters

      • value: T
      • index: number

      Returns U

Private _index

_index: number = 0

Private _source

_source: IIterator<T>

Methods

clone

  • Create an independent clone of the iterator.

    Returns IIterator<U>

    A new independent clone of the iterator.

iter

  • Get an iterator over the object's values.

    Returns IIterator<U>

    An iterator which yields the object's values.

next

  • next(): U | undefined
  • Get the next value from the iterator.

    Returns U | undefined

    The next value from the iterator, or undefined.

Generated using TypeDoc