-
Notifications
You must be signed in to change notification settings - Fork 0
union
Subhajit Sahu edited this page Dec 28, 2022
·
13 revisions
Obtain entries present in any lists.
Similar: union, intersection, difference, symmetricDifference, isDisjoint.
function union(x, y, fc)
// x: lists
// y: another lists
// fc: combine function (a, b)
const xlists = require('extra-lists');
var x = [['a', 'b', 'c'], [1, 2, 3]];
var y = [['b', 'c', 'd'], [20, 30, 40]];
xlists.union(x, y).map(v => [...v]);
// → [ [ 'a', 'b', 'c', 'd' ], [ 1, 2, 3, 40 ] ]
xlists.union(x, y, (a, b) => b).map(v => [...v]);
// → [ [ 'a', 'b', 'c', 'd' ], [ 1, 20, 30, 40 ] ]