( a: T, b: T | undefined, )
| 390 | * Shallow compare objects. |
| 391 | */ |
| 392 | export function shallowEqualObjects<T extends Record<string, any>>( |
| 393 | a: T, |
| 394 | b: T | undefined, |
| 395 | ): boolean { |
| 396 | if (!b || Object.keys(a).length !== Object.keys(b).length) { |
| 397 | return false |
| 398 | } |
| 399 | |
| 400 | for (const key in a) { |
| 401 | if (a[key] !== b[key]) { |
| 402 | return false |
| 403 | } |
| 404 | } |
| 405 | |
| 406 | return true |
| 407 | } |
| 408 | |
| 409 | export function isPlainArray(value: unknown): value is Array<unknown> { |
| 410 | return Array.isArray(value) && value.length === Object.keys(value).length |
no outgoing calls
no test coverage detected