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