Javascript Phone Number Formatter
bower install phoneformat.js
npm install phoneformat.js
All files for usage are in the /dist directory.
Function | Parameters | Example | ||
---|---|---|---|---|
countryForE164Number | phoneNumber : string | phoneFormat.countryForE164Number(validInternationalPhoneNumber); | ||
formatNumberForMobileDialing | countryCode : string, phoneNumber : string | phoneFormat.formatNumberForMobileDialing(countryCode, validPhoneNumber); | ||
isValidNumber | phoneNumber : string, countryCode : string | phoneFormat.isValidNumber(validPhoneNumber, countryCode); | ||
formatE164 | countryCode: string, phoneNumber : string | phoneFormat.formatE164(countryCode, validPhoneNumber); | ||
formatInternational | countryCode : string, phoneNumber : string | phoneFormat.formatInternational(countryCode, validPhoneNumber); | ||
formatLocal | countryCode : string, phoneNumber : string | phoneFormat.formatLocal(countryCode, validPhoneNumber); | ||
exampleLandlineNumber | countryCode : string | phoneFormat.exampleLandlineNumber(countryCode); | ||
exampleMobileNumber | countryCode : string | phoneFormat.exampleMobileNumber(countryCode); | ||
cleanPhone | phoneNumber : string | phoneFormat.cleanPhone(validPhoneNumber); | ||
countryCodeToName | countryCode : string | phoneFormat.countryCodeToName(countryCode); |
Is PhoneFormat.js in sync with the latest libphonenumber?
More often then not PhoneFormat.js will NOT be using the latest version of libphonenumber.
It was last synced v8.10.6
If this is causing you any headaches, please follow the instructions below to update the source files in /lib.
Step 1
Step 2
Step 3
Step 4
lib/google-libraries.js
with the compiled libraries from the compiler service.npm run build
This project was created by @albeebe.