Skip to content

Commit 9b8f59f

Browse files
authored
Merge pull request #1352 from darkdread/bugfix/equal-null-object
Optimize null checking
2 parents c2d153a + f97a3db commit 9b8f59f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/util.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ export const equal = (a: any, b: any, seen = []): boolean => {
118118
}
119119

120120
// typeof null is 'object'. If either is null, check if they are equal.
121-
if ((a === null || b === null) && a !== b) {
122-
return false;
121+
if (a === null || b === null) {
122+
return a === b;
123123
}
124-
124+
125125
// If this point has been reached, a and b are either arrays or objects.
126126

127127
if (a instanceof Array) {

0 commit comments

Comments
 (0)