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

#890 follow-up: exporting locales for isFloat #891

Closed
profnandaa opened this issue Sep 2, 2018 · 2 comments
Closed

#890 follow-up: exporting locales for isFloat #891

profnandaa opened this issue Sep 2, 2018 · 2 comments

Comments

@profnandaa
Copy link
Member

For my #890 PR, I intentionally left out isFloat since I noticed that it does not throw an error for "unsupported" locales but rather falls back on a default.

https://github.com/chriso/validator.js/blob/master/src/lib/isFloat.js#L7

Should we add throwing an error now since that has been the pattern for the rest, or will we be risking backward incompatibility (before line 7)?

// check for unsupported locale
// for uniformity with other locale-based functions
if (options.locale && !decimal[options.locale]) {
  throw new Error(`Invalid locale '${options.locale}'`);
}

OR

Should we just export the locales alone isFloatLocales and leave everything as is?

@profnandaa
Copy link
Member Author

@chriso ^

andela-anandaa pushed a commit to profnandaa/validator.js that referenced this issue Sep 2, 2018
This commit exports the list of supported locales for `isFloat`
as `isFloatLocales`

Ref: validatorjs#815, validatorjs#891, follow up for validatorjs#890
@chriso
Copy link
Collaborator

chriso commented Sep 11, 2018

Fixed by #892.

@chriso chriso closed this as completed Sep 11, 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

No branches or pull requests

2 participants