@@ -275,7 +275,7 @@ var iso3166_data = [
275275 { alpha2 : "VC" , alpha3 : "VCT" , country_code : "1" , country_name : "Saint Vincent And The Grenedines" , mobile_begin_with : [ ] , phone_number_lengths : [ 7 ] } ,
276276 { alpha2 : "VE" , alpha3 : "VEN" , country_code : "58" , country_name : "Venezuela, Bolivarian Republic of" , mobile_begin_with : [ "4" ] , phone_number_lengths : [ 10 ] } ,
277277 { alpha2 : "VG" , alpha3 : "VGB" , country_code : "1" , country_name : "Virgin Islands, British" , mobile_begin_with : [ "284" ] , phone_number_lengths : [ 10 ] } ,
278- { alpha2 : "VI" , alpha3 : "VIR" , country_code : "1" , country_name : "Virgin Islands, U.S." , mobile_begin_with : [ "340" ] , phone_number_lengths : [ 10 ] ] } ,
278+ { alpha2 : "VI" , alpha3 : "VIR" , country_code : "1" , country_name : "Virgin Islands, U.S." , mobile_begin_with : [ "340" ] , phone_number_lengths : [ 10 ] } ,
279279 { alpha2 : "VN" , alpha3 : "VNM" , country_code : "84" , country_name : "Viet Nam" , mobile_begin_with : [ "9" , "1" ] , phone_number_lengths : [ 9 , 10 ] } ,
280280 { alpha2 : "VU" , alpha3 : "VUT" , country_code : "678" , country_name : "Vanuatu" , mobile_begin_with : [ "5" , "7" ] , phone_number_lengths : [ 7 ] } ,
281281 { alpha2 : "WF" , alpha3 : "WLF" , country_code : "681" , country_name : "Wallis and Futuna" , mobile_begin_with : [ ] , phone_number_lengths : [ 6 ] } ,
@@ -325,15 +325,15 @@ function getISO3166(country) {
325325
326326function get_iso3166_by_phone ( phone ) {
327327 var regex ;
328- for ( var i in iso3166_data ) {
328+ for ( var i = 0 ; i < iso3166_data . length ; i ++ ) {
329329 regex = new RegExp ( '^' + iso3166_data [ i ] . country_code ) ;
330330
331- for ( var j in iso3166_data [ i ] . phone_number_lengths ) {
331+ for ( var j = 0 ; j < ( iso3166_data [ i ] . phone_number_lengths || [ ] ) . length ; j ++ ) {
332332 if ( phone . match ( regex ) && phone . length === iso3166_data [ i ] . country_code . length + iso3166_data [ i ] . phone_number_lengths [ j ] ) {
333333 // it match.. but may have more than one result.
334334 // e.g. USA and Canada. need to check mobile_begin_with
335335
336- for ( var k in iso3166_data [ i ] . mobile_begin_with ) {
336+ for ( var k = 0 ; k < iso3166_data [ i ] . mobile_begin_with . length ; k ++ ) {
337337 if ( phone . match ( new RegExp ( '^' + iso3166_data [ i ] . country_code + iso3166_data [ i ] . mobile_begin_with [ k ] ) ) ) {
338338 return iso3166_data [ i ]
339339 }
@@ -348,9 +348,9 @@ function get_iso3166_by_phone(phone) {
348348
349349function validate_phone_iso3166 ( phone , iso3166 ) {
350350 phone = phone . replace ( new RegExp ( '^' + iso3166 . country_code ) , '' ) ;
351- for ( var i in iso3166 . phone_number_lengths ) {
351+ for ( var i = 0 ; i < ( iso3166 . phone_number_lengths || [ ] ) . length ; i ++ ) {
352352 if ( phone . length === iso3166 . phone_number_lengths [ i ] ) {
353- for ( var j in iso3166 . mobile_begin_with ) {
353+ for ( var j = 0 ; j < iso3166 . mobile_begin_with . length ; j ++ ) {
354354 if ( phone . match ( new RegExp ( '^' + iso3166 . mobile_begin_with [ j ] ) ) ) {
355355 return true ;
356356 }
0 commit comments