Take any number of iterators, and zip them together into one iterator of tuples. It will continue yielding tuples until all the iterators have closed, putting undefined in the place of closed iterators.
undefined
import { pipe } from "yta";import { flatRepeat, of, range, take, toArray, zipLongest,} from "yta/sync";pipe( zipLongest( of("a", "b"), range(5), pipe( flatRepeat(() => of(true, false)), take(3) ), ), toArray(),);// => [// ["a", 0, true],// ["b", 1, false],// [undefined, 2, true],// [undefined, 3, undefined],// [undefined, 4, undefined],// ] Copy
import { pipe } from "yta";import { flatRepeat, of, range, take, toArray, zipLongest,} from "yta/sync";pipe( zipLongest( of("a", "b"), range(5), pipe( flatRepeat(() => of(true, false)), take(3) ), ), toArray(),);// => [// ["a", 0, true],// ["b", 1, false],// [undefined, 2, true],// [undefined, 3, undefined],// [undefined, 4, undefined],// ]
See also:
Tuple type with item type of each input iterator
The iterators to be zipped
Take any number of iterators, and zip them together into one iterator of tuples. It will continue yielding tuples until all the iterators have closed, putting
undefinedin the place of closed iterators.See also: