Skip to content

Commit f97a3db

Browse files
author
Walson Low (刘维昇)
committed
Optimize null checking
1 parent 320c8ce commit f97a3db

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)