Skip to content

Conversation

omkelderman
Copy link
Contributor

I found this while I was messing around with this package after I started doing some sveltekit prototyping. Just run the test I added in this PR without the included fix and notice how it stringifies it to just a normal zero.

I think the reason this fails is because indexes.has(thing) will return true if thing is negative zero and indexes contains a value for normal zero.

So my proposed fix is fairly simple: just first check for all the constants before checking the indexes map. Now I do not know if this has any unintended side-effects. So if I overlooked something feel free to deny this PR and cook up something else 😛.

Now while I dont really need correct support for negative zero myself, since the readme explicitly mentions support for it, I figured might as well PR it 😄.

Copy link

changeset-bot bot commented Aug 26, 2025

🦋 Changeset detected

Latest commit: 82f6620

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
devalue Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link
Member

@Rich-Harris Rich-Harris left a comment

Choose a reason for hiding this comment

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

thank you!

@Rich-Harris Rich-Harris merged commit ae904c5 into sveltejs:main Aug 26, 2025
3 checks passed
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.

2 participants