Open tux-tn opened 5 years ago
I don't know what the performance and size of libphonenumber is but I like the idea of outsourcing this rather complex validation to Google's package :-)
@chriso @profnandaa any feedback?
I'm good with it as long as it's going to be mostly opaque to the end user (+ be backward compatible). I don't know what @chriso thinks?
It's my understanding that libphonenumber
is huge so not something we'd look to incorporate into the library. I'd rather remove isMobilePhone
entirely and let the user decide whether the large footprint of libphonenumber
is worth it for their app.
Why isMobilePhone
validator is used language codes instead of country codes?
Ideally it should be country codes but for backward compatibility, we continued with the initial approach.
Hello,
The logic behind isMobilePhone is to provide a regex for every locale, but i can see that that there is many issues related to generic and too permissive regex. I can mention #917, #919 and #921 as examples and there is even more invalid validation rules:
true
true
And i think we can provide more examples with some research
That's why i'm suggesting we refactor
isMobilePhone
using Google's libphonenumber as a fully functional alternative. The project is under Apache 2.0 licence and provides a Javascript library.Waiting for your feedbacks