phone-formatter
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -14,4 +14,4 @@ module.exports = { | ||
// Normalize the phone number first if asked to do so in the options | ||
if (options && options.normalize === true) { | ||
// Normalize the phone number first unless not asked to do so in the options | ||
if (!options || !options.normalize) { | ||
phoneNumber = this.normalize(phoneNumber) | ||
@@ -18,0 +18,0 @@ }; |
{ | ||
"name": "phone-formatter", | ||
"description": "Parse and format telephone numbers.", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"homepage": "https://github.com/stevekinney/node-phone-formatter", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -29,9 +29,16 @@ # Phone Number Formatter | ||
That's cool. Pass some extra configuration options to the format method. | ||
That's cool. Do it. | ||
```javascript | ||
phoneFormatter.format("(212) 555-1212", "NNN.NNN.NNNN", {normalize: true}) | ||
phoneFormatter.format("(212) 555-1212", "NNN.NNN.NNNN") | ||
// returns "212.555.1212" | ||
``` | ||
If for some reason, this is not what you want: you can turn it off. | ||
```javascript | ||
phoneFormatter.format("(212) 555-1212", "NNN.NNN.NNNN", {normalize: false}) | ||
// Will probably crash and burn hideously. What are you even doing? | ||
``` | ||
## Documentation | ||
@@ -69,2 +76,3 @@ | ||
* 0.0.2: Normalize phone numbers by default. | ||
* 0.0.1: Just two methods and some tests. | ||
@@ -71,0 +79,0 @@ |
@@ -7,10 +7,10 @@ var assert = require('assert'); | ||
var testFormats = [ | ||
"(212) 555 1212", | ||
"(212) 555.1212", | ||
"(212) 555-1212", | ||
"(212) 5551212", | ||
"(212)5551212", | ||
"212 555 1212", | ||
"212.555.1212", | ||
"212-555-1212", | ||
"(212) 555 1212", | ||
"(212) 555.1212", | ||
"(212) 555-1212", | ||
"(212) 5551212", | ||
"(212)5551212", | ||
"212 555 1212", | ||
"212.555.1212", | ||
"212-555-1212", | ||
"1-212-555-1212", | ||
@@ -20,3 +20,3 @@ "+1 (212) 555-1212", | ||
"+45 (212) 555-1212", | ||
"2125551212" | ||
"2125551212" | ||
] | ||
@@ -124,3 +124,3 @@ | ||
assert.deepEqual( | ||
PhoneFormatter.format("(212) 555-1212", "NNN.NNN.NNNN", {normalize: true}), | ||
PhoneFormatter.format("(212) 555-1212", "NNN.NNN.NNNN"), | ||
"212.555.1212" | ||
@@ -132,2 +132,2 @@ ); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8131
124
81