Combines values from arrays.
npm install @extra-array/zip-longestCombines values from arrays. [:running:] [:vhs:] [:package:] [:moon:]
> Alternatives: [zip], [zipLongest].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.zipLongest(xs, vd, [fn], [ths]);
// xs: arrays
// vd: default value
// fn: map function (vs, i, xs)
// ths: this argument
`javascript
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 ]
``
- Data.List.zipWith: Haskell
- List-Extra.zip: elm
- _.zipWith: lodash
- itertools.zip_longest: Python
- zip: Ruby
[:running:]: https://npm.runkit.com/@extra-array/zip-longest
[:vhs:]: https://asciinema.org/a/329096
[:package:]: https://www.npmjs.com/package/@extra-array/zip-longest
[:moon:]: https://www.npmjs.com/package/@extra-array/zip-longest.min