-
Notifications
You must be signed in to change notification settings - Fork 1
union
wolfram77 edited this page Mar 27, 2020
·
29 revisions
Gives values present in any iterable.
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];
[...iterable.union(x, [2, 3, 5])];
// [1, 2, 3, 4, 5]
var x = [1, 2, 3, 4];
[...iterable.union(x, [-2, -3, -5], (a, b) => Math.abs(a) - Math.abs(b))];
// [1, 2, 3, 4, -5]