elearning/Frontend-Learner/node_modules/on-change/source/smart-clone/diff/is-diff-maps.js

20 lines
398 B
JavaScript
Raw Normal View History

2026-01-13 10:46:40 +07:00
export default function isDiffMaps(clone, value) {
if (clone === value) {
return false;
}
if (clone.size !== value.size) {
return true;
}
for (const [key, aValue] of clone) {
const bValue = value.get(key);
// Distinguish missing vs undefined and catch strict inequality
if (bValue !== aValue || (bValue === undefined && !value.has(key))) {
return true;
}
}
return false;
}