UNPKG

iteragain

Version:

Javascript Iterable/Iterator/Generator-function utilities.

12 lines 743 B
import type { IterSource, IteratorOrIterable } from './types'; /** * 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. * @example * toArray(tap(map([1, 2, 3], n => n * 2), console.log)); * // logs 2, 4, 6 to the console */ export declare function tap<T extends IteratorOrIterable<unknown>>(arg: T, func: (value: IterSource<T>) => any): IterableIterator<IterSource<T>>; export declare function tap<T extends IteratorOrIterable<unknown>>(func: (value: IterSource<T>) => any): (arg: T) => IterableIterator<IterSource<T>>; export default tap; //# sourceMappingURL=tap.d.ts.map