浏览代码

Added support for Venezuelan phone numbers

ReynierPM 11 年之前
父节点
当前提交
7c0ef6be16
共有 1 个文件被更改,包括 9 次插入2 次删除
  1. 9 2
      src/js/validator/phone.js

+ 9 - 2
src/js/validator/phone.js

@@ -10,6 +10,7 @@
             GB: 'United Kingdom',
             MA: 'Morocco',
             PK: 'Pakistan',
+            VE: 'Venezuelan',
             US: 'USA'
         }
     });
@@ -21,7 +22,7 @@
         },
 
         // The supported countries
-        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'MA', 'PK', 'US'],
+        COUNTRY_CODES: ['BR', 'ES', 'FR', 'GB', 'MA', 'PK', 'VE', 'US'],
 
         /**
          * Return true if the input value contains a valid phone number for the country
@@ -97,7 +98,13 @@
                     value   = $.trim(value);
                     isValid = (/^0?3[0-9]{2}[0-9]{7}$/).test(value);
                     break;
-                
+
+                case 'VE':
+                    // http://regex101.com/r/lR6hT5/1
+                    value   = $.trim(value);
+                    isValid = (/^0[0-9]{10}$/).test(value);
+                    break;
+
                 case 'US':
                 /* falls through */
                 default: