UNPKG

@n3okill/utils

Version:
34 lines 868 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.equalMap = equalMap; const equal_1 = require("./equal"); /** * Check if two maps have the same keys and values. * @param {T} a - The first map. * @param {U} b - The map to compare to a. * @returns `true` */ function equalMap(a, b) { if (a.size !== b.size) { return false; } if (a.size === 0) { return true; } for (const [key, value] of a) { let found = false; for (const [bKey, bValue] of b) { if ((0, equal_1.equal)(key, bKey)) { found = true; if (!(0, equal_1.equal)(value, bValue)) { return false; } } } if (!found) { return false; } } return true; } //# sourceMappingURL=equalMap.js.map