@sturdynut/i18n-phone-formatter

0.0.6 • Public • Published

Storage Poly | CircleCI Coverage Status

A Javascript phone number formatter that uses google's i18n library.

Requirements

  • Node 6+

Install

yarn add @sturdynut/i18n-phone-formatter or npm install @sturdynut/i18n-phone-formatter -S

Usage

import {
  formatE164
} from '@sturdynut/i18n-phone-formatter'; // or require('@sturdynut/i18n-phone-formatter')


formatE164('US', '4155552671'); // +14155552671

API

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);

Questions?

@sturdynut

Bugs?

Submit a bug

License

This project is distributed under the MIT license.

Readme

Keywords

none

Package Sidebar

Install

npm i @sturdynut/i18n-phone-formatter

Weekly Downloads

1

Version

0.0.6

License

MIT

Unpacked Size

302 kB

Total Files

21

Last publish

Collaborators

  • sturdynut