Skip to content

intersection

Subhajit Sahu edited this page Jun 12, 2020 · 13 revisions

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

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

object.intersection(x, y, [fn]);
// x:  an object
// y:  another object
// fn: combine function (a, b)
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3, d: 4};
var y = {b: 20, c: 30, e: 50};
object.intersection(x, y);
// { b: 2, c: 3 }

object.intersection(x, y, (a, b) => b);
// { b: 20, c: 30 }

references

Clone this wiki locally