@extra-array/zip-longest
TypeScript icon, indicating that this package has built-in type declarations

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

Package Sidebar

Install

npm i @extra-array/zip-longest

Weekly Downloads

1

Version

2.7.8

License

MIT

Unpacked Size

7.56 kB

Total Files

19

Last publish

Collaborators

  • wolfram77