-
Notifications
You must be signed in to change notification settings - Fork 1
isEqual
Subhajit Sahu edited this page Dec 5, 2022
·
15 revisions
Check if two maps are equal.
function isEqual(x, y, fc, fm)
// x: a map
// y: another map
// fc: compare function (a, b)
// fm: map function (v, k, x)
const map = require('extra-map');
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