Structural equality for parsed JSON values (objects compared key-insensitive to order).
(a: unknown, b: unknown)
| 391 | |
| 392 | /** Structural equality for parsed JSON values (objects compared key-insensitive to order). */ |
| 393 | function deepEqual(a: unknown, b: unknown): boolean { |
| 394 | if (a === b) return true; |
| 395 | if (typeof a !== typeof b || a === null || b === null) return false; |
| 396 | if (typeof a !== 'object') return false; |
| 397 | if (Array.isArray(a) || Array.isArray(b)) { |
| 398 | if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false; |
| 399 | return a.every((v, i) => deepEqual(v, b[i])); |
| 400 | } |
| 401 | const ao = a as Record<string, unknown>; |
| 402 | const bo = b as Record<string, unknown>; |
| 403 | const ak = Object.keys(ao); |
| 404 | const bk = Object.keys(bo); |
| 405 | if (ak.length !== bk.length) return false; |
| 406 | return ak.every((k) => Object.prototype.hasOwnProperty.call(bo, k) && deepEqual(ao[k], bo[k])); |
| 407 | } |
| 408 | |
| 409 | /** |
| 410 | * Compute which catalog entries changed between the base ref and HEAD. |
no outgoing calls
no test coverage detected
searching dependent graphs…