tapAsync
tapAsync<
T>(iterable,onItem):AsyncIterableIterator<T>
Defined in: packages/core/src/iterable/async/tap.ts:18
Yields the elements unchanged, running onItem for each as it passes.
The async counterpart of tap. An async onItem is awaited before the
element is yielded, so the side effect is ordered against the stream rather
than racing it.
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”The input iterable, sync or async.
onItem
Section titled “onItem”MaybeAsyncCallable<[T, number]>
Receives each element and its zero-based index. Its resolved value is ignored.
Returns
Section titled “Returns”AsyncIterableIterator<T>
An iterator over the unchanged elements.