From 20a2fa1bcbf7817a7814904247319972c2fcd44b Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Mon, 8 Jan 2018 20:20:00 -0500 Subject: [PATCH 1/2] fix configs --- .travis.yml | 5 ++--- appveyor.yml | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index efd82de1..ee8bff0b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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' diff --git a/appveyor.yml b/appveyor.yml index ebbad0a7..e0321d2a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,10 +2,13 @@ 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: @@ -13,15 +16,12 @@ install: - 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 From 76268084efcf6ae82c3f000913c33d14cc8714b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Serkan=20Yer=C5=9Fen?= Date: Tue, 6 Feb 2018 17:09:18 -0800 Subject: [PATCH 2/2] safer phoneNumber Helper --- lib/number.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/number.js b/lib/number.js index 15fd16b7..9d3f4642 100644 --- a/lib/number.js +++ b/lib/number.js @@ -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) + '-'