From 6ab3fb5fd1ae12605ddf1aac3f023f41dcddffa6 Mon Sep 17 00:00:00 2001 From: Oleksii Raspopov Date: Thu, 18 Apr 2024 10:25:22 -0400 Subject: [PATCH] use Object.is() for equality check --- modules/Data.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/Data.js b/modules/Data.js index 4c5c31c..cdd217e 100644 --- a/modules/Data.js +++ b/modules/Data.js @@ -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; }