( a: T, b: T | undefined, )
| 337 | * Shallow compare objects. |
| 338 | */ |
| 339 | export function shallowEqualObjects<T extends Record<string, any>>( |
| 340 | a: T, |
| 341 | b: T | undefined, |
| 342 | ): boolean { |
| 343 | if (!b || Object.keys(a).length !== Object.keys(b).length) { |
| 344 | return false |
| 345 | } |
| 346 | |
| 347 | for (const key in a) { |
| 348 | if (a[key] !== b[key]) { |
| 349 | return false |
| 350 | } |
| 351 | } |
| 352 | |
| 353 | return true |
| 354 | } |
| 355 | |
| 356 | export function isPlainArray(value: unknown): value is Array<unknown> { |
| 357 | return Array.isArray(value) && value.length === Object.keys(value).length |
no outgoing calls
no test coverage detected