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

isNumeric to support floating points #810

Merged
merged 3 commits into from May 3, 2018
Merged

Conversation

AmirSasson
Copy link
Contributor

see issue

@@ -546,7 +546,7 @@ function isAlphanumeric(str) {
throw new Error('Invalid locale \'' + locale + '\'');
}

var numeric = /^[-+]?[0-9]+$/;
var numeric = /^[+-]?([0-9]*[.])?[0-9]+$/;
Copy link
Contributor

Choose a reason for hiding this comment

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

Hey Amir. The regex looks like it should do the trick but unfortunately it's been implemented directly into the built version of validator.js. You'll want to implement it in the isNumeric source file, update the tests, and run the build and commit any changes.

The source file is this one: https://github.com/chriso/validator.js/blob/master/src/lib/isNumeric.js

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@pietvanzoen , done

@chriso
Copy link
Collaborator

chriso commented May 3, 2018

Thanks for the PR. This has been on the list for a while but it's a breaking change, so I'll add it and bump the major version.

@chriso chriso merged commit 02d31d2 into validatorjs:master May 3, 2018
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.

None yet

3 participants