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

[Bug] The inclusion validator validates "NaN" as a valid number... #106

Open
frykten opened this issue Oct 20, 2021 · 0 comments
Open

[Bug] The inclusion validator validates "NaN" as a valid number... #106

frykten opened this issue Oct 20, 2021 · 0 comments

Comments

@frykten
Copy link
Contributor

frykten commented Oct 20, 2021

Hi!

I'm pretty sure this was not meant to be as it wasn't tested as an accepted value:

  • with the inclusion validator, in a number-typed range, NaN is validated as true, whatever happens.

The issue is pretty simple when reading the code: https://github.com/offirgolan/ember-validators/blob/1568f472eb5d9851222b9944521ff1ba529641dd/addon/inclusion.js#L42

When checking their type, NaN and any number will return true as they are all numbers. And NaN is neither superior nor inferior to any number---since it has no value... So it will never return the validationError...

I'll file a PR for that, and I'll add a check to the tests suite.

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

No branches or pull requests

1 participant