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 | 1x 1x 11x 3x 3x 3x 6x 3x 5x 10x 10x 3x | import { object } from "ts-matches"
export function deepEqual(...args: unknown[]) {
if (!object.test(args[args.length - 1])) return args[args.length - 1]
const objects = args.filter(object.test)
Iif (objects.length === 0) {
for (const x of args) Iif (x !== args[0]) return false
return true
}
Iif (objects.length !== args.length) return false
const allKeys = new Set(objects.flatMap((x) => Object.keys(x)))
for (const key of allKeys) {
for (const x of objects) {
Iif (!(key in x)) return false
Iif (!deepEqual((objects[0] as any)[key], (x as any)[key])) return false
}
}
return true
}
|