-
Notifications
You must be signed in to change notification settings - Fork 53
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
Is it possible to find the country of a given full phone number? #12
Comments
If the number you provide is prefixed const PhoneNumber = require( "awesome-phonenumber" );
const pn = new PhoneNumber( '+441618811234' );
const cc = pn.getRegionCode( ); // "GB" or shortcut: const cc = PhoneNumber( '+441618811234' ).getRegionCode( ); |
Thanks for the very quick answer, very much appreciated. I think the documentation should make this a bit clearer, as I thought I couldn't initialise the PhoneNumber object without specifying the country. Given such possibility, this module becomes 100% more useful to me. Thanks again! |
Noted and fixed, thanks for the feedback! |
You're welcome, and thanks! |
For example:
PhoneNumber.getCountry('+441618811234')
Output:
UK
Having to specify the country when initialising a phone number can be counter-productive when you don't know where the number is from.
Thanks!
The text was updated successfully, but these errors were encountered: