catamphetamine / libphonenumber-js

A simpler (and smaller) rewrite of Google Android's libphonenumber library in javascript

Home Page:https://catamphetamine.gitlab.io/libphonenumber-js/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Any property returns area code?

TheMuyu opened this issue · comments

Hi,
using asYouType, is there a way to get area code like getting country code? Or do I need to extract it using template?

const asYouType = new AsYouType();
asYouType.input('+351220404000');
console.log(asYouType.getCountry())

can we have like asYouType.getAreaCode()

https://github.com/catamphetamine/libphonenumber-js#class-asyoutypedefaultcountry-string--options-object

.getCallingCode()

Hello this is returning country code I want to get area code which is after country code in masking

number: +351220404000
mask: xxxx xx xxx xxxx (.getTemplate())
formatted: +351 22 040 4000

so in there .getCallingCode() is returning 351 but I want area code which is 22.
Its basically second element of masking. I'm extracting it from there but I would like to know if there is a property about it.

Oh, you meant "area code".
There's no function for that.