github
1710 of 2234 branches covered (76.54%)
Branch coverage included in aggregate %.
94 of 141 new or added lines in 25 files covered. (66.67%)
20319 existing lines in 272 files now uncovered.35902 of 63049 relevant lines covered (56.94%)
11.42 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
|
} |
× |