Take any number of iterators, and zip them together into one iterator of tuples. Closes after the shortest of the inputs closes.
import { pipe } from "yta";import { flatRepeat, of, range, toArray, zip } from "yta/sync";pipe( zip( of("a", "b", "c"), range(), flatRepeat(() => of(true, false)), ), toArray(),);// => [["a", 0, true], ["b", 1, false], ["c", 2, true]] Copy
import { pipe } from "yta";import { flatRepeat, of, range, toArray, zip } from "yta/sync";pipe( zip( of("a", "b", "c"), range(), flatRepeat(() => of(true, false)), ), toArray(),);// => [["a", 0, true], ["b", 1, false], ["c", 2, true]]
If you want to zip an iterator of iterators in a pipeline you can use them spread opperator.
import { pipe } from "yta";import { flatRepeat, of, range, toArray, zip } from "yta/sync";pipe( of( of("a", "b", "c"), range(), flatRepeat(() => of(true, false)), ), (iterables) => zip(...iterables), toArray(),);// => [["a", 0, true], ["b", 1, false], ["c", 2, true]] Copy
import { pipe } from "yta";import { flatRepeat, of, range, toArray, zip } from "yta/sync";pipe( of( of("a", "b", "c"), range(), flatRepeat(() => of(true, false)), ), (iterables) => zip(...iterables), toArray(),);// => [["a", 0, true], ["b", 1, false], ["c", 2, true]]
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. Closes after the shortest of the inputs closes.
If you want to zip an iterator of iterators in a pipeline you can use them spread opperator.
See also: