Skip to content

isEqual

Subhajit Sahu edited this page Dec 8, 2022 · 12 revisions

Check if two objects are equal.

Similar: compare, isEqual.


function isEqual(x, y, fc, fm)
// x:  an object
// y:  another object
// fc: compare function (a, b)
// fm: map function (v, k, x)
const object = require('extra-object');

var x = {a: 1, b: 2};
object.isEqual(x, {a: 1, b: 2});
// → true

object.isEqual(x, {a: 11, b: 12});
// → false

object.isEqual(x, {a: 11, b: 12}, (a, b) => (a % 10) - (b % 10));
// → true

object.isEqual(x, {a: 11, b: 12}, null, v => v % 10);
// → true


References

Clone this wiki locally