UNPKG

@klodianimeri/pipejs

Version:

Pipe functions that provide convenient and efficient ways to work with iterators.

20 lines (14 loc) 397 B
import { Pipe } from "../pipe.js"; export function entries(): Pipe { return () => { let i: number = -1; return (result: IteratorResult<any>): IteratorResult<any> => { if (result?.done) { return result; } ++i; result.value = [i, result.value]; return result; }; } }