Describe the bug
I would like to verify that numbers displayed contain a separator. For example comma in the US. Validation will fail if I have a number without the separator.
Examples
1,000 ==> true
1000 ==> false
Additional context
Validator.js version: 13.1.0
Node.js version: v12.16.2
OS platform: macOS
@OlllllllO can you be able to share the function/code you used in that case?
Or, are you trying to suggest a new functionality?
I think this would be new functionality, but I don't have a suggestion as to where it should go. Would it make sense to add an option for isNumeric()? Perhaps something like this:
validator.isNumeric('1,000', [{ thousands_separator: ',' }] ⇨ true
validator.isNumeric('1000', [{ thousands_separator: ',' }] ⇨ false
validator.isNumeric('1,000', [{ thousands_separator: ',' }, { no_symbols: true }, {locale: 'en-US' }] ⇨ true
...
Since the American and British English agrees with comma or space separator for 1000 as a number, I will agree to the addition.
Let's hear from @profnandaa and @tux-tn thinking on this.
Also, as an opinion, there could be cases where in the future we need to allow users to validate both numeric with and without separators, e.g whether a user passes
1000, 1,000 or 1 000 and an option like accept_with_without_seperator as true then all of these passes
I don't know what are your thoughts @profnandaa, @OlllllllO, @theerapatcha, @tux-tn, and @rubiin.
Also, as an opinion, there could be cases where in the future we need to allow users to validate both numeric with and without separators, e.g whether a user passes
1000, 1,000 or 1 000and an option likeaccept_with_without_seperator as truethen all of these passes
I don't know what are your thoughts @profnandaa, @OlllllllO, @theerapatcha, @tux-tn, and @rubiin.
I think adding option accept_with_without_seperator will be useful for people