-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fix(ext/node): fix deepStrictEqual(-0, 0) #29060
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -103,7 +103,7 @@ export function equal(c: unknown, d: unknown): boolean { | |||
return aTime === bTime; | |||
} | |||
if (typeof a === "number" && typeof b === "number") { | |||
return NumberIsNaN(a) && NumberIsNaN(b) || a === b; | |||
return NumberIsNaN(a) && NumberIsNaN(b) || Object.is(a, b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the ObjectIs
primordial here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, a quick deno fmt
should resolve the remaining CI error
@@ -103,7 +103,7 @@ export function equal(c: unknown, d: unknown): boolean { | |||
return aTime === bTime; | |||
} | |||
if (typeof a === "number" && typeof b === "number") { | |||
return NumberIsNaN(a) && NumberIsNaN(b) || a === b; | |||
return NumberIsNaN(a) && NumberIsNaN(b) || ObjectIs(a, b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Object.is(NaN, NaN)
is true
.
return NumberIsNaN(a) && NumberIsNaN(b) || ObjectIs(a, b); | |
return ObjectIs(a, b); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
closes #28037