Skip to content

isEqual

Subhajit Sahu edited this page Jun 17, 2020 · 11 revisions

Checks if two maps are equal. 🏃 📼 📦 🌔 📒

Similar: compare, isEqual.

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

var x = new Map([['a', 1], ['b', 2]]);
var y = new Map([['a', 1], ['b', 2]]);
map.isEqual(x, y);
// true

var y = new Map([['a', 11], ['b', 12]]);
map.isEqual(x, y);
// false

map.isEqual(x, y, (a, b) => (a % 10) - (b % 10));
// true

map.isEqual(x, y, null, v => v % 10);
// true

references

Clone this wiki locally