validatorjs / validator.js

String validation
MIT License
23.01k stars 2.29k forks source link

Name Convention for phone numbers #750

Closed TallOrderDev closed 6 years ago

TallOrderDev commented 6 years ago

'isMobilePhone' seems like a incorrect name as it's not only checking mobile numbers. This could be confusing, and there are a few ways to determine/guess if a number is Mobile, so it indicates that it's doing something that it is not.

isPhoneNumber isPhone isPhoneNum

profnandaa commented 6 years ago

It never hit me! Though this will be serious breaking changes, I'd suggest that we have isPhoneNumber as alias...

chriso commented 6 years ago

The validator should only be checking whether a string is a mobile phone number. The lines are obviously blurred in some locales, and/or people have snuck in general phone validation.

This library will never have general international phone validation. It's too hard; just use libphonenumber.

For more info, see:

TallOrderDev commented 6 years ago

@chriso could you give some clarity between a mobile number and house or work number? As in the US these are all the same format so there is no checkable difference between any of the three.