@telefonica/libphonenumber
v2.9.0
Published
libphonenumber wrapper
Downloads
4,762
Readme
libphonenumber js wrapper
Wrapper around a custom compilation of Google's libphonenumber.
- Compiled using ADVANCED_OPTIMIZATIONS to obtain the smallest possible library
- Only the needed features should be exposed. This way the compiler can effectively remove unused code
API
formatAsYouType(number: string, viewerRegionCode: string): string;
formatToE164(phone: PhoneNumber): string;
formatToInternational(phone: PhoneNumber): string;
formatToNational(phone: PhoneNumber): string;
formatToNationalNumberWithCarrierCode(phoneNumber: PhoneNumber, carrierCode: string): string;
formatToPrint(phone: PhoneNumber, viewerRegionCode: string): string;
getPhoneNumberType(number: string, regionCode: string): string;
getRegionCodeForNumber(number: string, defaultRegionCode: string): string;
getRegionCodeForCountryCode(countryCode: string): string;
getPhoneDestinationTypeForNumber(number: string, defaultRegionCode: string): string;
isMobile(phone: PhoneNumber): boolean;
isMobileOrFixedLine(phone: PhoneNumber): boolean;
isShort(phone: PhoneNumber): boolean;
isValidNumber(phone: PhoneNumber): boolean;
parse(number: string, regionCode: string): PhoneNumber;
Install
yarn add @telefonica/libphonenumber