Learn about our RFC process, Open RFC meetings & more.Join in the discussion! »

@extra-array/zip-longest

2.7.8 • Public • Published

Combines values from arrays. 🏃 📼 📦 🌔

Alternatives: [zip], [zipLongest].
This is part of package extra-array.

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

Install

npm i @extra-array/zip-longest

DownloadsWeekly Downloads

0

Version

2.7.8

License

MIT

Unpacked Size

7.56 kB

Total Files

19

Last publish

Collaborators

  • avatar