Skip to content

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

Merged
merged 4 commits into from
Apr 27, 2025

Conversation

kt3k
Copy link
Member

@kt3k kt3k commented Apr 26, 2025

closes #28037

@@ -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);
Copy link
Contributor

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

Copy link
Contributor

@marvinhagemeister marvinhagemeister left a 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);
Copy link
Contributor

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.

Suggested change
return NumberIsNaN(a) && NumberIsNaN(b) || ObjectIs(a, b);
return ObjectIs(a, b);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@kt3k kt3k merged commit 84b192e into denoland:main Apr 27, 2025
18 checks passed
@kt3k kt3k deleted the fix-node-assert-deep-strict-equal branch April 27, 2025 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ext/node: assert.deepStrictEqual(-0, 0) should throw
3 participants