@extra-array/zip-longest.min
v2.7.8
Published
Combines values from arrays.
Downloads
4
Maintainers
Readme
Combines values from arrays. :running: :vhs: :package: :moon:
Alternatives: [zip], [zipLongest]. This is part of package extra-array.
This is browserified, minified version of @extra-array/zip-longest. It is exported as global variable array_zipLongest. CDN: unpkg, jsDelivr.
array.zipLongest(xs, vd, [fn], [ths]);
// xs: arrays
// vd: default value
// fn: map function (vs, i, xs)
// ths: this argument
const array = require('extra-array');
var x = [1, 2, 3];
var y = [4, 5];
array.zipLongest([x, y], 0);
// [ [ 1, 4 ], [ 2, 5 ], [ 3, 0 ] ]
array.zipLongest([x, y], 0, ([a, b]) => a + b);
// [ 5, 7, 3 ]