Commit 651dd1f0a998bc89f0ff500949b110a3dede5031

Authored by OpenWapp Developer
1 parent 3a15be1eea

Comments addressed

Showing 2 changed files with 6 additions and 7 deletions

app/scripts/utils/PhoneNumberMetaDataUpdates.js View file @ 651dd1f
1 1 /* global PHONE_NUMBER_META_DATA */
  2 +/* jshint maxlen: 535 */
2 3 /**
3 4 * This file is intented to patch our current version of PhoneNumber.js.
4 5 * 1) Brazilian numbers
5   - * 2) Venezuelan numbers
6 6 */
7 7 define(['libphonenumber/PhoneNumberMetaData'],
8 8 function () {
9 9 'use strict';
10 10  
11   - // Patching brazilian numbers
12   - var brazil = PHONE_NUMBER_META_DATA[55];
13   - var patched = brazil.replace(',"119",', ',"^(?:1[1-9]|2[12478])9",');
14   - PHONE_NUMBER_META_DATA[55] = patched;
15   - // Patching Venezuela numbers
  11 + // Patching brazilian numbers. The rule only allowed a "119" as a mobile
  12 + // prefix in some cases, that we change for: ^(?:1[1-9]|2[12478])9.
  13 + // @see: http://en.wikipedia.org/wiki/Telephone_numbers_in_Brazil#Ninth_digit_for_mobile_numbers
  14 + PHONE_NUMBER_META_DATA[55] = '["BR","00(?:1[45]|2[135]|[34]1|43)","0","0(?:(1[245]|2[135]|[34]1)(\\d{10,11}))?","$2",,"\\d{8,11}","[1-46-9]\\d{7,10}|5\\d{8,9}",[["(\\d{4})(\\d{4})","$1-$2","[2-9](?:[1-9]|0[1-9])","$FG","NA"],["(\\d{5})(\\d{4})","$1-$2","9(?:[1-9]|0[1-9])","$FG","NA"],["(\\d{2})(\\d{5})(\\d{4})","$1 $2-$3","^(?:1[1-9]|2[12478])9","($FG)",],["(\\d{2})(\\d{4})(\\d{4})","$1 $2-$3","[1-9][1-9]","($FG)",],["([34]00\\d)(\\d{4})","$1-$2","[34]00",,],["([3589]00)(\\d{2,3})(\\d{4})","$1 $2 $3","[3589]00","$NP$FG",]]]';
16 15 }
17 16 );
app/scripts/utils/phonenumber.js View file @ 651dd1f
... ... @@ -105,7 +105,7 @@
105 105 // Clean the number
106 106 number = number.replace(/[^\d\+]+/g, '');
107 107  
108   - _region = (locale || _region).toUpperCase();
  108 + _region = (locale || _region || '').toUpperCase();
109 109  
110 110 if (beforeRules[_region]) {
111 111 beforeRules[_region].forEach(function (rule) {