(
a: {[key: string | symbol]: any},
b: {[key: string | symbol]: any},
)
| 19 | } |
| 20 | |
| 21 | export function shallowEqual( |
| 22 | a: {[key: string | symbol]: any}, |
| 23 | b: {[key: string | symbol]: any}, |
| 24 | ): boolean { |
| 25 | // While `undefined` should never be possible, it would sometimes be the case in IE 11 |
| 26 | // and pre-chromium Edge. The check below accounts for this edge case. |
| 27 | const k1 = a ? getDataKeys(a) : undefined; |
| 28 | const k2 = b ? getDataKeys(b) : undefined; |
| 29 | if (!k1 || !k2 || k1.length != k2.length) { |
| 30 | return false; |
| 31 | } |
| 32 | let key: string | symbol; |
| 33 | for (let i = 0; i < k1.length; i++) { |
| 34 | key = k1[i]; |
| 35 | if (!equalArraysOrString(a[key], b[key])) { |
| 36 | return false; |
| 37 | } |
| 38 | } |
| 39 | return true; |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Gets the keys of an object, including `symbol` keys. |
no test coverage detected
searching dependent graphs…