2.7.8 • Published 4 years ago

@extra-array/zip-longest.min v2.7.8

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Combines values from arrays. :running: :package:

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 ]

references