Skip to content

Commit

Permalink
Merge pull request #187 from thasner/patch-1
Browse files Browse the repository at this point in the history
Account for `NaN === NaN` evaluating to `false`
  • Loading branch information
dashed committed Jan 6, 2021
2 parents bda92c6 + 7acc3e9 commit 239db02
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = function shallowEqual(objA, objB, compare, compareContext) {
return !!ret;
}

if (objA === objB) {
if (Object.is(objA, objB)) {
return true;
}

Expand Down Expand Up @@ -37,7 +37,7 @@ module.exports = function shallowEqual(objA, objB, compare, compareContext) {

ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;

if (ret === false || (ret === void 0 && valueA !== valueB)) {
if (ret === false || (ret === void 0 && !Object.is(valueA, valueB))) {
return false;
}
}
Expand Down

0 comments on commit 239db02

Please sign in to comment.