An NPM package for simplifying phone number
The phone number is only formated basing on North America (+1) at the moment.
Install using npm.
npm install phone-simplifier
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>
const phone = require('phone-simplifier')
let simplifiedPhone = phone.clean('phone-number-string');
Examples:
+1 (234) 567-8910 => +12345678910
234-567-8910 => 2345678910
Feel free to report bugs and make feature requests in the Issue Tracker, fork and create pull requests!
Apache License 2.0