From ff044ed9c4153e59c45b109709e054daf7944db9 Mon Sep 17 00:00:00 2001 From: shadefinale Date: Wed, 11 Nov 2015 12:09:34 -0600 Subject: Edit locales and replaceSymbolwithNumber for more accurate US/CA phone numbers. --- lib/locales/en/phone_number/formats.js | 40 +++++++++++++++---------------- lib/locales/en_CA/phone_number/formats.js | 30 +++++++++++------------ test/phone_number.unit.js | 4 ++-- 3 files changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/locales/en/phone_number/formats.js b/lib/locales/en/phone_number/formats.js index 2eb1f5f9..d3eec219 100644 --- a/lib/locales/en/phone_number/formats.js +++ b/lib/locales/en/phone_number/formats.js @@ -1,22 +1,22 @@ module["exports"] = [ - "###-!##-####", - "(!##) ###-####", - "1-!##-###-####", - "!##.###.####", - "!##-###-####", - "(!##) ###-####", - "1-!##-###-####", - "!##.###.####", - "!##-###-#### x###", - "(!##) ###-#### x###", - "1-!##-###-#### x###", - "!##.###.#### x###", - "!##-###-#### x####", - "(!##) ###-#### x####", - "1-!##-###-#### x####", - "!##.###.#### x####", - "!##-###-#### x#####", - "(!##) ###-#### x#####", - "1-!##-###-#### x#####", - "!##.###.#### x#####" + "!##-!##-####", + "(!##) !##-####", + "1-!##-!##-####", + "!##.!##.####", + "!##-!##-####", + "(!##) !##-####", + "1-!##-!##-####", + "!##.!##.####", + "!##-!##-#### x###", + "(!##) !##-#### x###", + "1-!##-!##-#### x###", + "!##.!##.#### x###", + "!##-!##-#### x####", + "(!##) !##-#### x####", + "1-!##-!##-#### x####", + "!##.!##.#### x####", + "!##-!##-#### x#####", + "(!##) !##-#### x#####", + "1-!##-!##-#### x#####", + "!##.!##.#### x#####" ]; diff --git a/lib/locales/en_CA/phone_number/formats.js b/lib/locales/en_CA/phone_number/formats.js index d73d6826..c5b85ebe 100644 --- a/lib/locales/en_CA/phone_number/formats.js +++ b/lib/locales/en_CA/phone_number/formats.js @@ -1,18 +1,18 @@ module["exports"] = [ - "!##-###-####", - "(!##)###-####", - "!##.###.####", + "!##-!##-####", + "(!##)!##-####", + "!##.!##.####", "1-!##-###-####", - "!##-###-#### x###", - "(!##)###-#### x###", - "1-!##-###-#### x###", - "!##.###.#### x###", - "!##-###-#### x####", - "(!##)###-#### x####", - "1-!##-###-#### x####", - "!##.###.#### x####", - "!##-###-#### x#####", - "(!##)###-#### x#####", - "1-!##-###-#### x#####", - "!##.###.#### x#####" + "!##-!##-#### x###", + "(!##)!##-#### x###", + "1-!##-!##-#### x###", + "!##.!##.#### x###", + "!##-!##-#### x####", + "(!##)!##-#### x####", + "1-!##-!##-#### x####", + "!##.!##.#### x####", + "!##-!##-#### x#####", + "(!##)!##-#### x#####", + "1-!##-!##-#### x#####", + "!##.!##.#### x#####" ]; diff --git a/test/phone_number.unit.js b/test/phone_number.unit.js index 5cd4aba5..442a602a 100644 --- a/test/phone_number.unit.js +++ b/test/phone_number.unit.js @@ -31,7 +31,7 @@ describe("phone_number.js", function () { for (var i = 0; i < 25; i++) { var phone_number = faker.phone.phoneNumberFormat(1); console.log(phone_number) - assert.ok(phone_number.match(/\([2-9]\d\d\) \d\d\d-\d\d\d\d/)); + assert.ok(phone_number.match(/\([2-9]\d\d\) [2-9]\d\d-\d\d\d\d/)); } }); @@ -39,7 +39,7 @@ describe("phone_number.js", function () { faker.locale = "en_CA"; for (var i = 0; i < 25; i++) { var phone_number = faker.phone.phoneNumberFormat(1); - assert.ok(phone_number.match(/\([2-9]\d\d\)\d\d\d-\d\d\d\d/)); + assert.ok(phone_number.match(/\([2-9]\d\d\)[2-9]\d\d-\d\d\d\d/)); } }); -- cgit v1.2.3