-
Notifications
You must be signed in to change notification settings - Fork 1
union
Subhajit Sahu edited this page May 10, 2020
·
29 revisions
Gives values present in any iterable. 🏃 [:vhs:] 📦 🌔
iterable.union(x, y, [fn]);
// x: an iterable
// y: another iterable
// fn: compare function (a, b)
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4];
var y = [2, 3, 5];
[...iterable.union(x, y)];
// [ 1, 2, 3, 4, 5 ]
var y = [-2, -3, -5];
[...iterable.union(x, y, (a, b) => Math.abs(a) - Math.abs(b))];
// [ 1, 2, 3, 4, -5 ]