github
946 of 1273 branches covered (74.31%)
Branch coverage included in aggregate %.
117 of 146 new or added lines in 9 files covered. (80.14%)
24638 existing lines in 277 files now uncovered.31680 of 63169 relevant lines covered (50.15%)
2.0 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
|
} |
× |