Skip to content

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