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