Skip to content

Commit

Permalink
use Object.is() for equality check
Browse files Browse the repository at this point in the history
  • Loading branch information
alexeyraspopov committed Apr 18, 2024
1 parent 60c98b8 commit 6ab3fb5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions modules/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ export class Data {
let a = this[key];
let b = other[key];
if (
a !== b &&
!Object.is(a, b) &&
(a == null ||
b == null ||
(a instanceof Data && b instanceof Data ? !a.equals(b) : a.valueOf() !== b.valueOf()))
(a instanceof Data && b instanceof Data
? !a.equals(b)
: !Object.is(a.valueOf(), b.valueOf())))
)
return false;
}
Expand Down

0 comments on commit 6ab3fb5

Please sign in to comment.