( a: T, b: T | undefined, )
| 441 | * @returns `true` if both objects have the same keys, with strictly equal values for each key. |
| 442 | */ |
| 443 | export function shallowEqualObjects<T extends Record<string, any>>( |
| 444 | a: T, |
| 445 | b: T | undefined, |
| 446 | ): boolean { |
| 447 | if (!b || Object.keys(a).length !== Object.keys(b).length) { |
| 448 | return false |
| 449 | } |
| 450 | |
| 451 | for (const key of Object.keys(a)) { |
| 452 | if (!hasOwn.call(b, key) || a[key] !== b[key]) { |
| 453 | return false |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | return true |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Checks whether a value is an array with no holes and no extra properties. |
no outgoing calls
no test coverage detected