saven
Version:
48 lines (36 loc) • 893 B
JavaScript
/* eslint-disable */
Object.is = Object.is || function (x, y) {
if (x === y) {
return x !== 0 || 1 / x === 1 / y;
}
return x !== x && y !== y;
};
function shallowEqual(obj1, obj2) {
if (obj1 === null && obj2 === null) {
return true;
}
if (obj1 === null || obj2 === null) {
return false;
}
if (Object.is(obj1, obj2)) {
return true;
}
var obj1Keys = obj1 ? Object.keys(obj1) : [];
var obj2Keys = obj2 ? Object.keys(obj2) : [];
if (obj1Keys.length !== obj2Keys.length) {
return false;
}
for (var i = 0; i < obj1Keys.length; i++) {
var obj1KeyItem = obj1Keys[i];
if (!obj2.hasOwnProperty(obj1KeyItem) || !Object.is(obj1[obj1KeyItem], obj2[obj1KeyItem])) {
return false;
}
}
return true;
}
var index = {
shallowEqual: shallowEqual
};
export default index;
export { shallowEqual };
//# sourceMappingURL=index.js.map