-
Notifications
You must be signed in to change notification settings - Fork 1
zip
Subhajit Sahu edited this page May 17, 2020
·
32 revisions
Combines values from iterables. 🏃 📼 📦 🌔 📒
iterable.zip(xs, [fm], [ft], [vd]);
// xs: iterables
// fm: map function (vs, i, xs)
// ft: till function (dones)
// vd: default value
const iterable = require('extra-iterable');
var x = [1, 2, 3];
var y = [4, 5, 6];
[...iterable.zip([x, y])];
// [ [ 1, 4 ], [ 2, 5 ], [ 3, 6 ] ]
[...iterable.zip([x, y], 0, ([a, b]) => a + b)];
// [ 5, 7, 9 ]