Skip to content

intersection

Subhajit Sahu edited this page Feb 4, 2021 · 15 revisions

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

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

entries.intersection(x, y, [fc]);
// x:  entries
// y:  another entries
// fc: combine function (a, b)
const entries = require("extra-entries");

var x = [["a", 1], ["b", 2], ["c", 3], ["d", 4]];
var y = [["b", 20], ["c", 30], ["e", 50]];
[...entries.intersection(x, y)];
// [ [ "b", 2 ], [ "c", 3 ] ]

[...entries.intersection(x, y, (a, b) => b)];
// [ [ "b", 20 ], [ "c", 30 ] ]

references

Clone this wiki locally