Skip to content
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

fix stringify not picking up negative zero if a normal zero has appeared before it #87

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

omkelderman
Copy link

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 😄.

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.

1 participant