telephone stuff
Parse, format, and validate US phone numbers
Install
$ npm install telephone-stuff
Usage
var phones = phones//=> 4155551234 phones//=> 12312312345 phones//=> 415-555-1234 phones//=> 123.123.1234 phones//=> true
API
phones.parse(phone)
-> string
phone
Required
Type: string
A phone number to parse. A leading 1
country code will be stripped.
phones.format(phone, [separator])
-> string
Format a 10 digit phone string by adding separators and truncating extra digits.
phone
Required
Type: string
A phone number to format. Digits only.
separator
Type: string
Default: '-'
phones.validate(phone)
-> boolean
Returns false if phone
is not a string with exactly 10 digits.
phone
Required
Type: string
A phone number to validate as a 10 digit string.
Forked from bendrucker/phones