Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 2x 2x 2x 6868x 1324x 1324x 1324x 544x 540x 540x 2018x 530x 780x 745x 745x 9x 9x 8x 8x 8x 6x 736x 736x 736x 733x 732x 4464x 4464x 718x 35x | const isArray = Array.isArray;
const OBJ_PROTO = Object.prototype;
export const deepEqual = (a: unknown, b: unknown): boolean => {
// Primitives
if (a === b) return true;
let length: number = 0,
i: number = 0;
// Arrays
if (isArray(a)) {
if (!isArray(b)) return false;
length = a.length;
if (length !== (b as Array<unknown>).length) return false;
for (i = length; i-- !== 0; ) if (!deepEqual(a[i], (b as Array<unknown>)[i])) return false;
return true;
}
// Objects
if (a && b && typeof a === 'object' && typeof b === 'object') {
specific: {
if ((<any>a).__proto__ === OBJ_PROTO) break specific;
if (a instanceof Uint8Array) {
if (!(b instanceof Uint8Array)) return false;
const length = a.length;
if (length !== b.length) return false;
for (let i = 0; i < length; i++) Iif (a[i] !== b[i]) return false;
return true;
}
}
const keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
if (isArray(b)) return false;
for (i = length; i-- !== 0; ) {
const key = keys[i];
if (!deepEqual((a as Record<string, unknown>)[key], (b as Record<string, unknown>)[key])) return false;
}
return true;
}
return false;
};
|