tap
tap<
T>(iterable,onItem):IterableIterator<T>
Defined in: packages/core/src/iterable/tap.ts:17
Yields the elements unchanged, running onItem for each as it passes.
How a lazy pipeline is instrumented: the side effect runs when an element is pulled, not when the pipeline is built, so nothing is observed that the consumer did not ask for.
Time complexity: O(1) per element, plus whatever onItem costs.
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”iterable
Section titled “iterable”Iterable<T>
The input iterable.
onItem
Section titled “onItem”Callable<[T, number]>
Receives each element and its zero-based index. Its return value is ignored.
Returns
Section titled “Returns”IterableIterator<T>
An iterator over the unchanged elements.