Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,5 @@ node_js:
- '5'
- '4'
- '0.12'
before_script:
- npm install -g gulp-cli
script: gulp
allowed_failures:
node_js: '0.12'
6 changes: 3 additions & 3 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@
environment:
matrix:
# node.js
- nodejs_version: "9.0"
- nodejs_version: "8.0"
- nodejs_version: "7.0"
- nodejs_version: "6.0"
- nodejs_version: "5.0"
- nodejs_version: "4.0"
- nodejs_version: "0.12"

# Install scripts. (runs after repo cloning)
install:
# Get the latest stable version of Node.js or io.js
- ps: Install-Product node $env:nodejs_version
# install modules
- npm install
- npm install -g gulp-cli

# Post-install test scripts.
test_script:
# Output useful info for debugging.
- node --version
- npm --version
# run tests
- gulp

# Don't actually build.
build: off
10 changes: 8 additions & 2 deletions lib/number.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,14 @@ helpers.addCommas = function(num) {
* @api public
*/

helpers.phoneNumber = function(num) {
num = num.toString();
helpers.phoneNumber = function(value) {
var num = value.toString().replace(/\D+/, '');

// format only the numbers you can format.
// If it's not going to work, don't do it.
if (num === '' || num.length !== 10) {
return value;
}

return '(' + num.substr(0, 3) + ') '
+ num.substr(3, 3) + '-'
Expand Down