/phone-simplifier

An NPM package for simplifying phone number

Primary LanguageJavaScriptApache License 2.0Apache-2.0

phone-simplifier

Build Status

An NPM package for simplifying phone number

The phone number is only formated basing on North America (+1) at the moment.

Installation

Install using npm.

npm install phone-simplifier

Usage

Simplify your phone number

const phone = require('phone-simplifier')

let simplifiedPhoneNumber = phone.simplify('phone-number-string');

Examples:

+1 (234) 567-8910   => +1 (234) 567-8910
+12345678910        => (234) 567-8910
2345678910          => (234) 567-8910
234-567-8910        => (234) 567-8910
<empty or special characters> => <empty string>

Get clean phone number

const phone = require('phone-simplifier')

let simplifiedPhone = phone.clean('phone-number-string');

Examples:

+1 (234) 567-8910   => +12345678910
234-567-8910        => 2345678910

Contributions

Feel free to report bugs and make feature requests in the Issue Tracker, fork and create pull requests!

LICENSE

Apache License 2.0