Skip to content

difference$

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

Gives entries of object not present in another. 🏃 📼 📦 🌔 📒

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

object.difference$(x, y);
// x: an object (updated)
// y: another object
// --> x
const object = require('extra-object');

var x = {a: 1, b: 2, c: 3, d: 4, e: 5};
var y = {b: 2, d: 4};
object.difference$(x, y);
// { a: 1, c: 3, e: 5 }

x;
// { a: 1, c: 3, e: 5 }

var x = {a: 1, b: 2, c: 3, d: 4, e: 5};
var y = {b: -2, d: -4};
object.difference$(x, y);
// { a: 1, c: 3, e: 5 }

references

Clone this wiki locally