rxdb
Version:
A local-first realtime NoSQL Database for JavaScript applications - https://rxdb.info/
42 lines (40 loc) • 1.49 kB
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.deepEqual = deepEqual;
/**
* Copied from the fast-deep-equal package
* because it does not support es modules and causes optimization bailouts.
* TODO use the npm package again when this is merged:
* @link https://github.com/epoberezkin/fast-deep-equal/pull/105
*/
function deepEqual(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length;
var i;
if (Array.isArray(a)) {
length = a.length;
if (length !== b.length) return false;
for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false;
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
var keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
for (i = length; i-- !== 0;) {
var key = keys[i];
if (!deepEqual(a[key], b[key])) return false;
}
return true;
}
// true if both NaN, false otherwise
return a !== a && b !== b;
}
//# sourceMappingURL=utils-object-deep-equal.js.map
;