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 NaN detection in .is() #159

Merged
merged 1 commit into from
Jun 9, 2022
Merged

Fix NaN detection in .is() #159

merged 1 commit into from
Jun 9, 2022

Conversation

panva
Copy link
Contributor

@panva panva commented Feb 21, 2022

NaN is not a number, this fixes the is() return for it.

before

is(NaN) // => 'number'

after

is(NaN) // => 'NaN'

Fixes #160

@panva
Copy link
Contributor Author

panva commented Feb 21, 2022

I think this doesn't have to be considered a breaking but will leave that up to you @sindresorhus.

@sindresorhus
Copy link
Owner

The PR looks good, but since I'm planning a major release here in a month or two, I'm gonna keep this PR open until such time, as I don't see the point in risking it breaking for someone.

@sindresorhus
Copy link
Owner

Tests are failing.

@sindresorhus sindresorhus changed the title Fix NaN .is() return Fix NaN detection in .is() Feb 24, 2022
@panva
Copy link
Contributor Author

panva commented Feb 24, 2022

Number.isNaN is not defined to only take an argument of type number.

I can either // @ts-ignore this , put it back to the number switch case it was at originally, or cast to <number> to satisfy this broken type definition.

@sindresorhus
Copy link
Owner

put it back to the number switch case it was at originally

I guess this is the easiest then. Sorry for the back and forth.

@sindresorhus sindresorhus merged commit c408f5a into sindresorhus:main Jun 9, 2022
@sindresorhus
Copy link
Owner

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.

[v5] Better handling of NaN
2 participants