catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript
https://catamphetamine.gitlab.io/libphonenumber-js/
MIT License
2.77k stars 218 forks source link

[Feature] Could we know why the phone number is not possible? #406

Closed remi-blaise closed 3 years ago

remi-blaise commented 3 years ago

Hi!

It would be great to be able to retrieve the reason why the function isPossible() fails. Is phone number too short, too long for the country, ...

Let me know if it is possible or planned to be added to the library.

Thank you for your time, Remi

catamphetamine commented 3 years ago

The isPossible() function only checks number length, as stated in the readme.

catamphetamine commented 3 years ago

https://github.com/catamphetamine/libphonenumber-js#ispossible-boolean

remi-blaise commented 3 years ago

Yeah I know that, I was advocating for a new feature.

catamphetamine commented 3 years ago

Yeah I know that, I was advocating for a new feature.

Read the text from link I've provided. It should be self-explanatory.

catamphetamine commented 3 years ago

@remi-blaise Oh, you wanted to know whether it's short or long.

catamphetamine commented 3 years ago

Published libphonenumber-js@1.9.26.

https://gitlab.com/catamphetamine/libphonenumber-js#validatephonenumberlengthinput-string-string

remi-blaise commented 2 years ago

You are amazing, great feature, thanks!

remi-blaise commented 2 years ago

I used the feature in my app, it works great!