phones
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -13,3 +13,9 @@ 'use strict' | ||
separator = separator == null ? ' ' : separator | ||
return separate(phone, separator, [3, 6]) | ||
var country = phone.charAt(0) === '1' | ||
phone = phone.substring(0, country ? 11 : 10) | ||
var separators = country ? [1, 4, 7] : [3, 6] | ||
return separate(phone, separator, separators) | ||
} | ||
@@ -16,0 +22,0 @@ |
{ | ||
"name": "phones", | ||
"main": "index.js", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Parse, format, and validate US phone numbers", | ||
@@ -6,0 +6,0 @@ "license": "MIT", |
@@ -41,3 +41,3 @@ # phones [![Build Status](https://travis-ci.org/bendrucker/phones.svg?branch=master)](https://travis-ci.org/bendrucker/phones) | ||
Format a 10 digit phone string by adding separators. | ||
Format a 10 digit phone string by adding separators and truncating extra digits. | ||
@@ -44,0 +44,0 @@ ##### phone |
3315
17