3 // do not edit .js files directly - edit src/index.jst
6 var envHasBigInt64Array = typeof BigInt64Array !== 'undefined';
9 module.exports = function equal(a, b) {
10 if (a === b) return true;
12 if (a && b && typeof a == 'object' && typeof b == 'object') {
13 if (a.constructor !== b.constructor) return false;
16 if (Array.isArray(a)) {
18 if (length != b.length) return false;
19 for (i = length; i-- !== 0;)
20 if (!equal(a[i], b[i])) return false;
25 if ((a instanceof Map) && (b instanceof Map)) {
26 if (a.size !== b.size) return false;
27 for (i of a.entries())
28 if (!b.has(i[0])) return false;
29 for (i of a.entries())
30 if (!equal(i[1], b.get(i[0]))) return false;
34 if ((a instanceof Set) && (b instanceof Set)) {
35 if (a.size !== b.size) return false;
36 for (i of a.entries())
37 if (!b.has(i[0])) return false;
41 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {
43 if (length != b.length) return false;
44 for (i = length; i-- !== 0;)
45 if (a[i] !== b[i]) return false;
50 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
51 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
52 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
54 keys = Object.keys(a);
56 if (length !== Object.keys(b).length) return false;
58 for (i = length; i-- !== 0;)
59 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
61 for (i = length; i-- !== 0;) {
64 if (key === '_owner' && a.$$typeof) {
65 // React-specific: avoid traversing React elements' _owner.
66 // _owner contains circular references
67 // and is not needed when comparing the actual elements (and not their owners)
71 if (!equal(a[key], b[key])) return false;
77 // true if both NaN, false otherwise
78 return a!==a && b!==b;