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

@extra-iterable/merge.min

2.5.13 • Public • Published

Merges values from sorted iterables. 🏃 📼 📦 🌔 📒

Similar: sort, merge.
This is part of package extra-iterable.

This is browserified, minified version of @extra-iterable/merge.
It is exported as global variable iterable_merge.
CDN: unpkg, jsDelivr.

iterable.merge(xs, [fc], [fm]);
// xs: iterables
// fc: compare function (a, b)
// fm: map function (v, i, x)
const iterable = require('extra-iterable');
 
var x = [1, 3, 5, 7];
var y = [2, 4, 8];
[...iterable.merge([x, y])];
// [
//   1, 2, 3, 4,
//   5, 7, 8
// ]
 
var y = [-2, -4, -8];
[...iterable.merge([x, y], (a, b) => Math.abs(a) - Math.abs(b))];
// [
//   1, -2,  3, -4,
//   5,  7, -8
// ]
 
[...iterable.merge([x, y], null, v => Math.abs(v))];
// [
//   1, -2,  3, -4,
//   5,  7, -8
// ]

references

Install

npm i @extra-iterable/merge.min

DownloadsWeekly Downloads

143

Version

2.5.13

License

MIT

Unpacked Size

13.7 kB

Total Files

24

Last publish

Collaborators

  • avatar