Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sturdynut/i18n-phone-formatter
https://github.com/sturdynut/i18n-phone-formatter
Last synced: 8 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/sturdynut/i18n-phone-formatter
- Owner: sturdynut
- License: mit
- Created: 2018-11-15T00:03:19.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-08T17:04:37.000Z (almost 2 years ago)
- Last Synced: 2023-02-26T04:06:43.598Z (over 1 year ago)
- Language: HTML
- Size: 724 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Storage Poly | [![CircleCI](https://circleci.com/gh/sturdynut/i18n-phone-formatter/tree/master.svg?style=svg&circle-token=c75d9cef31f5d841ff8201af2923ade3e7500602)](https://circleci.com/gh/sturdynut/i18n-phone-formatter/tree/master) [![Coverage Status](https://coveralls.io/repos/github/sturdynut/i18n-phone-formatter/badge.svg?branch=master)](https://coveralls.io/github/sturdynut/i18n-phone-formatter?branch=master)
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
```javascript
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](https://twitter.com/sturdynut)
## Bugs?
[Submit a bug](https://github.com/sturdynut/i18n-phone-formatter/issues)
## License
This project is distributed under the MIT license.