-
Notifications
You must be signed in to change notification settings - Fork 0
union
Subhajit Sahu edited this page Jun 18, 2020
·
13 revisions
Gives lists present in any lists. 🏃 📼 📦 🌔 📒
Alternatives: union, union$.
Similar: union, intersection, difference, symmetricDifference, isDisjoint.
lists.union(x, y, [fc]);
// x: lists
// y: another lists
// fc: combine function (a, b)const entries = require('extra-lists');
var x = [['a', 1], ['b', 2], ['c', 3]];
var y = [['b', 20], ['c', 30], ['d', 40]];
[...entries.union(x, y)];
// [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ], [ 'd', 40 ] ]
[...entries.union(x, y, (a, b) => b)];
// [ [ 'a', 1 ], [ 'b', 20 ], [ 'c', 30 ], [ 'd', 40 ] ]