1212 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313 * See the License for the specific language governing permissions and
1414 * limitations under the License.
15- */
15+ */
1616var iso3166alpha = [
17-
17+
1818 'VAT' , 'MCO' , 'GIB' , 'TKL' , 'CCK' , 'BLM' , 'NRU' , 'TUV' , 'MAC' , 'SXM' ,
1919 'MAF' , 'NFK' , 'PCN' , 'BVT' , 'BMU' , 'IOT' , 'SMR' , 'GGY' , 'AIA' , 'MSR' ,
2020 'JEY' , 'CXR' , 'WLF' , 'VGB' , 'LIE' , 'ABW' , 'MHL' , 'ASM' , 'COK' , 'SPM' ,
@@ -235,31 +235,30 @@ function iso2ccode(territoryAlphaCode) {
235235 }
236236 }
237237
238- var i , isoa ;
238+ var i , isoa ;
239239 var sep = territoryAlphaCode . lastIndexOf ( '-' ) ;
240240 if ( sep >= 0 ) { // territory!
241241 var prefix = territoryAlphaCode . substring ( 0 , sep ) ;
242242 var properMapcode = territoryAlphaCode . substring ( sep + 1 ) ;
243- if ( set_disambiguate ( prefix ) || properMapcode . length < 2 ) {
243+ if ( set_disambiguate ( prefix ) || properMapcode . length < 2 ) {
244244 return - 1 ;
245245 }
246246 i = findISO ( parentname2 ( disambiguate ) + '-' + properMapcode ) ;
247- if ( i >= 0 ) {
247+ if ( i >= 0 ) {
248248 return i ;
249249 }
250250 // recognise alias
251- if ( properMapcode . length == 3 ) {
251+ if ( properMapcode . length == 3 )
252252 isoa = alias2iso ( properMapcode ) ;
253- } else {
253+ else
254254 isoa = alias2iso ( disambiguate + '' + properMapcode ) ;
255- }
256255 if ( isoa ) {
257256 if ( isoa . charAt ( 0 ) == disambiguate ) {
258257 properMapcode = isoa . substring ( 1 ) ;
259258 } else {
260259 properMapcode = isoa ;
261260 i = findISO ( properMapcode ) ;
262- if ( i >= 0 ) {
261+ if ( i >= 0 ) {
263262 return i ;
264263 }
265264 }
@@ -268,7 +267,7 @@ function iso2ccode(territoryAlphaCode) {
268267 }
269268
270269 // first rewrite alias in context
271- if ( territoryAlphaCode . length == 2 ) {
270+ if ( territoryAlphaCode . length == 2 ) {
272271 isoa = alias2iso ( disambiguate + '' + territoryAlphaCode ) ;
273272 if ( isoa ) {
274273 if ( isoa . charAt ( 0 ) == disambiguate ) {
@@ -280,41 +279,41 @@ function iso2ccode(territoryAlphaCode) {
280279 }
281280
282281 // no prefix. check if a normal territory
283- if ( territoryAlphaCode . length == 3 ) {
282+ if ( territoryAlphaCode . length == 3 ) {
284283 i = findISO ( territoryAlphaCode ) ;
285- if ( i >= 0 ) {
284+ if ( i >= 0 ) {
286285 return i ;
287286 }
288287 }
289288
290289 // no prefix, check in context
291290 i = findISO ( parentname2 ( disambiguate ) + '-' + territoryAlphaCode ) ;
292- if ( i >= 0 ) {
291+ if ( i >= 0 ) {
293292 return i ;
294293 }
295294
296295
297- if ( territoryAlphaCode . length >= 2 ) {
296+ if ( territoryAlphaCode . length >= 2 ) {
298297 i = findISO ( parentname2 ( disambiguate ) + '-' + territoryAlphaCode ) ;
299- if ( i >= 0 ) {
300- return i ;
298+ if ( i >= 0 ) {
299+ return i ;
301300 }
302301 // find in ANY context
303302 var hyphenated = '-' + territoryAlphaCode ;
304303 for ( i = 0 ; i < iso3166alpha . length ; i ++ ) {
305- if ( iso3166alpha [ i ] . indexOf ( hyphenated ) > 0 ) {
306- if ( iso3166alpha [ i ] . substring ( iso3166alpha [ i ] . indexOf ( hyphenated ) ) == hyphenated ) {
304+ if ( iso3166alpha [ i ] . indexOf ( hyphenated ) > 0 ) {
305+ if ( iso3166alpha [ i ] . substring ( iso3166alpha [ i ] . indexOf ( hyphenated ) ) == hyphenated ) {
307306 return i ;
308307 }
309308 }
310309 }
311310 }
312-
311+
313312 // all else failed, try non-disambiguated alphacode
314313 isoa = alias2iso ( territoryAlphaCode ) ; // or try ANY alias
315314 if ( isoa ) {
316315 if ( isoa . charCodeAt ( 0 ) <= 57 ) { // starts with digit
317- territoryAlphaCode = parentname2 ( isoa . charCodeAt ( 0 ) - 48 ) + '-' + isoa . substring ( 1 ) ;
316+ territoryAlphaCode = parentname2 ( isoa . charCodeAt ( 0 ) - 48 ) + '-' + isoa . substring ( 1 ) ;
318317 } else {
319318 territoryAlphaCode = isoa ;
320319 }
@@ -439,11 +438,11 @@ function getTerritoryAlphaCode(territory, format) {
439438 }
440439 var full = iso3166alpha [ territoryNumber ] ;
441440 var hyphen = full . indexOf ( "-" ) ;
442- if ( format == 1 || hyphen <= 0 ) {
441+ if ( format == 1 || hyphen <= 0 ) {
443442 return full ;
444443 }
445- var short = full . substr ( hyphen + 1 ) ;
446- if ( format == 0 ) {
444+ var short = full . substr ( hyphen + 1 ) ;
445+ if ( format == 0 ) {
447446 return short ;
448447 }
449448 // shortest POSSIBLE
@@ -455,7 +454,7 @@ function getTerritoryAlphaCode(territory, format) {
455454 count = 2 ;
456455 } else {
457456 for ( i = 0 ; i < iso3166alpha . length ; i ++ ) {
458- if ( iso3166alpha [ i ] . indexOf ( "-" + short ) > 0 ) {
457+ if ( iso3166alpha [ i ] . indexOf ( "-" + short ) > 0 ) {
459458 count ++ ;
460459 }
461460 }
@@ -1140,7 +1139,7 @@ var asc2lan = [
11401139 [ 0x0C1E , 0x0C15 , 0x0C17 , 0x0C19 , 0x0C2B , 0x0C1A , 0x0C1C , 0x0C1F , 0x0049 , 0x0C20 , 0x0C21 , 0x0C23 , 0x0C24 , 0x0C25 , 0x004f , 0x0C26 , 0x0C27 , 0x0C28 , 0x0C2A , 0x0C2C , 0x0C2D , 0x0C2E , 0x0C30 , 0x0C32 , 0x0C33 , 0x0C35 , 0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 ] , // Telugu
11411140 [ 0x0B1D , 0x0B15 , 0x0B16 , 0x0B17 , 0x0B23 , 0x0B18 , 0x0B1A , 0x0B1C , 0x0049 , 0x0B1F , 0x0B21 , 0x0B22 , 0x0B24 , 0x0B25 , 0x0B20 , 0x0B26 , 0x0B27 , 0x0B28 , 0x0B2A , 0x0B2C , 0x0B39 , 0x0B2E , 0x0B2F , 0x0B30 , 0x0B33 , 0x0B38 , 0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 ] , // Odia
11421141 [ 0x0C92 , 0x0C95 , 0x0C96 , 0x0C97 , 0x0C8E , 0x0C99 , 0x0C9A , 0x0C9B , 0x0049 , 0x0C9C , 0x0CA0 , 0x0CA1 , 0x0CA3 , 0x0CA4 , 0x004f , 0x0CA6 , 0x0CA7 , 0x0CA8 , 0x0CAA , 0x0CAB , 0x0C87 , 0x0CAC , 0x0CAD , 0x0CB0 , 0x0CB2 , 0x0CB5 , 0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 ] , // Kannada
1143- [ 0x0AB3 , 0x0A97 , 0x0A9C , 0x0AA1 , 0x0A87 , 0x0AA6 , 0x0AAC , 0x0A95 , 0x0049 , 0x0A9A , 0x0A9F , 0x0AA4 , 0x0AAA , 0x0AA0 , 0x004f , 0x0AB0 , 0x0AB5 , 0x0A9E , 0x0AAE , 0x0AAB , 0x0A89 , 0x0AB7 , 0x0AA8 , 0x0A9D , 0x0AA2 , 0x0AAD , 0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 ] , // Gujarati
1142+ [ 0x0AB3 , 0x0A97 , 0x0A9C , 0x0AA1 , 0x0A87 , 0x0AA6 , 0x0AAC , 0x0A95 , 0x0049 , 0x0A9A , 0x0A9F , 0x0AA4 , 0x0AAA , 0x0AA0 , 0x004f , 0x0AB0 , 0x0AB5 , 0x0A9E , 0x0AAE , 0x0AAB , 0x0A89 , 0x0AB7 , 0x0AA8 , 0x0A9D , 0x0AA2 , 0x0AAD , 0x0030 , 0x0031 , 0x0032 , 0x0033 , 0x0034 , 0x0035 , 0x0036 , 0x0037 , 0x0038 , 0x0039 ] , // Gujarati
11441143]
11451144
11461145
@@ -1183,7 +1182,7 @@ var lanlannam = [
11831182 [ "кириллица" ] ,
11841183 [ "עִבְרִית" ] ,
11851184 [ "देवनागरी" ] , // Devanagari
1186- [ "മലയാളം" ] , // Malayalam
1185+ [ "മലയാളം" ] , // Malayalam
11871186 [ "ქართული" ] ,
11881187 [ "カタカナ" ] ,
11891188 [ "ภาษาไทย" ] ,
@@ -1195,8 +1194,8 @@ var lanlannam = [
11951194 [ "العَرَبِيَّة" ] ,
11961195 [ "조선글/한글" ] , // Korean (Choson'gul / Hangul )
11971196 [ "မြန်မာအက္ခရာ" ] , // Burmese
1198- [ "អក្សរខ្មែរ" ] , // Khmer script
1199- [ 'සිංහල අක්ෂර මාලාව' ] , // Sinhalese
1197+ [ "អក្សរខ្មែរ" ] , // Khmer script
1198+ [ 'සිංහල අක්ෂර මාලාව' ] , // Sinhalese
12001199 [ "ތާނަ" ] , // Thaana (Maldivan)
12011200 [ "ㄅㄆㄇㄈ" ] , // Chinese (bopomofo) // 注音符號,
12021201 [ "ⵜⵉⴼⵉⵏⴰⵖ" ] , // Tifinagh (Berber)
0 commit comments