github
1903 of 2546 branches covered (74.74%)
Branch coverage included in aggregate %.
775 of 823 new or added lines in 10 files covered. (94.17%)
17884 existing lines in 262 files now uncovered.37927 of 62547 relevant lines covered (60.64%)
158.97 hits per line
1 |
// TODO - can we reuse the core util? Assuming we don't want to export it
|
1✔ |
2 |
|
1✔ |
3 |
/* eslint-disable complexity */
|
1✔ |
4 |
|
1✔ |
5 |
// Compares two objects to see if their keys are shallowly equal
|
1✔ |
6 |
export function shallowEqualObjects(a, b) {
|
|
UNCOV
7
|
if (a === b) {
|
× |
UNCOV
8
|
return true; |
× |
UNCOV
9
|
} |
× |
UNCOV
10
|
|
× |
UNCOV
11
|
if (typeof a !== 'object' || a === null || typeof b !== 'object' || b === null) { |
× |
UNCOV
12
|
return false; |
× |
UNCOV
13
|
} |
× |
UNCOV
14
|
|
× |
UNCOV
15
|
if (Object.keys(a).length !== Object.keys(b).length) {
|
× |
UNCOV
16
|
return false; |
× |
UNCOV
17
|
} |
× |
UNCOV
18
|
|
× |
UNCOV
19
|
for (const key in a) { |
× |
UNCOV
20
|
if (!(key in b) || a[key] !== b[key]) {
|
× |
UNCOV
21
|
return false; |
× |
UNCOV
22
|
} |
× |
UNCOV
23
|
} |
× |
UNCOV
24
|
for (const key in b) { |
× |
UNCOV
25
|
if (!(key in a)) {
|
× |
26 |
return false; |
× |
27 |
} |
× |
UNCOV
28
|
} |
× |
UNCOV
29
|
return true; |
× |
UNCOV
30
|
} |
× |