( a: Readonly<Record<string, unknown>>, b: Readonly<Record<string, unknown>>, )
| 208 | } |
| 209 | |
| 210 | function shallowRecordEqual( |
| 211 | a: Readonly<Record<string, unknown>>, |
| 212 | b: Readonly<Record<string, unknown>>, |
| 213 | ): boolean { |
| 214 | const aKeys = Object.keys(a); |
| 215 | const bKeys = Object.keys(b); |
| 216 | if (aKeys.length !== bKeys.length) return false; |
| 217 | for (const key of aKeys) { |
| 218 | if (!(key in b)) return false; |
| 219 | if (!Object.is(a[key], b[key])) return false; |
| 220 | } |
| 221 | return true; |
| 222 | } |
| 223 | |
| 224 | export function compositePropsEqual(prev: unknown, next: unknown): boolean { |
| 225 | if (Object.is(prev, next)) return true; |
no test coverage detected