Combines values from iterables.
:package:
:smileycat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:bluebook:
Similar: cartesianProduct, zip.
This is part of package extra-iterable.
This is browserified, minified version of @extra-iterable/zip.
It is exported as global variable iterablezip.
CDN: unpkg, jsDelivr.
iterable.zip(xs, [fm], [ft], [vd]);
// xs: iterables
// fm: map function (vs, i, xs)
// ft: till function (dones) (some)
// vd: default value
const iterable = require("extra-iterable");
var x = [1, 2, 3];
var y = [4, 5];
[...iterable.zip([x, y])];
// [ [ 1, 4 ], [ 2, 5 ] ] (shortest)
[...iterable.zip([x, y], ([a, b]) => a + b)];
// [ 5, 7 ]
[...iterable.zip([x, y], null, iterable.some)];
// [ [ 1, 4 ], [ 2, 5 ] ] (shortest)
[...iterable.zip([x, y], null, iterable.every, 0)];
// [ [ 1, 4 ], [ 2, 5 ], [ 3, 0 ] ] (longest)
[...iterable.zip([x, y], null, iterable.head, 0)];
// [ [ 1, 4 ], [ 2, 5 ], [ 3, 0 ] ] (first)