-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Added option to validate any phone locale #663
Conversation
Could you add a test case and also make a note in the README? Thanks. |
@chriso I have added tests for 'any' locale. There is also a note in README. For maintainability, I moved all valid/invalid phonenumbers in the tests into their own variables and use them when testing 'any' argument. |
Perfect. Thanks! |
Thanks! When will you do a new minor release which would include this? |
Probably not for a little while since I just tagged |
Locales added in v7.2: - any (validatorjs/validator.js#663) - en-KE (validatorjs/validator.js#673) - en-UG, en-RW, en-TZ (validatorjs/validator.js#676) Missing locales (but added in this commit): - da-DK (validatorjs/validator.js#601) - uk-UA (validatorjs/validator.js#585) - en-NG (validatorjs/validator.js#616) - en-PK (validatorjs/validator.js#630) - he-IL (validatorjs/validator.js#610) - ro-RO (validatorjs/validator.js#627) - zh-HK (validatorjs/validator.js#622) Non-existent locales: - fr-BE, nl-BE (validatorjs/validator.js#700)
This PR will add locale option 'any'. It will pass if any of the given mobile phone locales are valid. I find it very useful in situations where users can insert just a phone number regardless of locale.