Function tap

  • Tap into the input iterator by supplying func which is passed each value of this iterator. The return value of func is unused and this method is purely designed for a designated place to perform side effects.

    Type Parameters

    Parameters

    Returns IterableIterator<IterSource<T>>

    toArray(tap(map([1, 2, 3], n => n * 2), console.log));
    // logs 2, 4, 6 to the console
  • Type Parameters

    Parameters

    Returns ((arg: T) => IterableIterator<IterSource<T>>)