Skip to content

symmetricDifference

Subhajit Sahu edited this page Jun 18, 2020 · 14 revisions

Gives entries not present in both lists. 🏃 📼 📦 🌔 📒

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

lists.symmetricDifference(x, y);
// x: lists
// y: another lists
const entries = require('extra-entries');

var x = [['a', 1], ['b', 2], ['c', 3], ['d', 4]];
var y = [['c', 30], ['d', 40], ['e', 50], ['f', 60]];
[...entries.symmetricDifference(x, y)];
// [ [ 'a', 1 ], [ 'b', 2 ], [ 'e', 50 ], [ 'f', 60 ] ]

var y = [['d', 40], ['e', 50], ['f', 60]];
[...entries.symmetricDifference(x, y)];
// [ [ 'a', 1 ], [ 'b', 2 ], [ 'c', 3 ], [ 'e', 50 ], [ 'f', 60 ] ]

references

Clone this wiki locally