Skip to content

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

@profnandaa

Description

@profnandaa

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions