Skip to content

difference

Subhajit Sahu edited this page Dec 28, 2022 · 16 revisions

Obtain entries not present in another ilists.

Similar: union, intersection, difference, symmetricDifference, isDisjoint.


function difference(x, y)
// x: ilists
// y: another ilists
const xilists = require('extra-ilists');

var x = [['a', 'b', 'c', 'd', 'e'], [1, 2, 3, 4, 5]];
var y = [['b', 'd'], [2, 4]];
xilists.difference(x, y).map(c => [...c]);
// → [ [ 'a', 'c', 'e' ], [ 1, 3, 5 ] ]

var y = [['b', 'd'], [-2, -4]];
xilists.difference(x, y).map(c => [...c]);
// → [ [ 'a', 'c', 'e' ], [ 1, 3, 5 ] ]


References

Clone this wiki locally