2.2.30 • Published 5 years ago
@extra-iterable/zip-shortest.min v2.2.30
Combines values from iterables, till shortest. :running: :package: :ledger:
Alternatives: zip, zipShortest, zipLongest, zipFirst. This is part of package extra-iterable.
This is browserified, minified version of @extra-iterable/zip-shortest. It is exported as global variable iterable_zipShortest. CDN: unpkg, jsDelivr.
iterable.zipShortest(xs, [vd], [fn], [ths]);
// xs: iterables
// vd: default value
// fn: map function (vs, i, xs)
// ths: this argument
const iterable = require('extra-iterable');
var x = [1, 2, 3];
var y = [4, 5];
[...iterable.zipShortest([x, y])];
// [ [ 1, 4 ], [ 2, 5 ] ]
[...iterable.zipShortest([x, y], 0, ([a, b]) => a + b)];
// [ 5, 7 ]