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,30 +235,31 @@ 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+ }
255256 if ( isoa ) {
256257 if ( isoa . charAt ( 0 ) == disambiguate ) {
257258 properMapcode = isoa . substring ( 1 ) ;
258259 } else {
259260 properMapcode = isoa ;
260261 i = findISO ( properMapcode ) ;
261- if ( i >= 0 ) {
262+ if ( i >= 0 ) {
262263 return i ;
263264 }
264265 }
@@ -267,7 +268,7 @@ function iso2ccode(territoryAlphaCode) {
267268 }
268269
269270 // first rewrite alias in context
270- if ( territoryAlphaCode . length == 2 ) {
271+ if ( territoryAlphaCode . length == 2 ) {
271272 isoa = alias2iso ( disambiguate + '' + territoryAlphaCode ) ;
272273 if ( isoa ) {
273274 if ( isoa . charAt ( 0 ) == disambiguate ) {
@@ -279,41 +280,41 @@ function iso2ccode(territoryAlphaCode) {
279280 }
280281
281282 // no prefix. check if a normal territory
282- if ( territoryAlphaCode . length == 3 ) {
283+ if ( territoryAlphaCode . length == 3 ) {
283284 i = findISO ( territoryAlphaCode ) ;
284- if ( i >= 0 ) {
285+ if ( i >= 0 ) {
285286 return i ;
286287 }
287288 }
288289
289290 // no prefix, check in context
290291 i = findISO ( parentname2 ( disambiguate ) + '-' + territoryAlphaCode ) ;
291- if ( i >= 0 ) {
292+ if ( i >= 0 ) {
292293 return i ;
293294 }
294295
295296
296- if ( territoryAlphaCode . length >= 2 ) {
297+ if ( territoryAlphaCode . length >= 2 ) {
297298 i = findISO ( parentname2 ( disambiguate ) + '-' + territoryAlphaCode ) ;
298- if ( i >= 0 ) {
299- return i ;
299+ if ( i >= 0 ) {
300+ return i ;
300301 }
301302 // find in ANY context
302303 var hyphenated = '-' + territoryAlphaCode ;
303304 for ( i = 0 ; i < iso3166alpha . length ; i ++ ) {
304- if ( iso3166alpha [ i ] . indexOf ( hyphenated ) > 0 ) {
305- if ( iso3166alpha [ i ] . substring ( iso3166alpha [ i ] . indexOf ( hyphenated ) ) == hyphenated ) {
305+ if ( iso3166alpha [ i ] . indexOf ( hyphenated ) > 0 ) {
306+ if ( iso3166alpha [ i ] . substring ( iso3166alpha [ i ] . indexOf ( hyphenated ) ) == hyphenated ) {
306307 return i ;
307308 }
308309 }
309310 }
310311 }
311-
312+
312313 // all else failed, try non-disambiguated alphacode
313314 isoa = alias2iso ( territoryAlphaCode ) ; // or try ANY alias
314315 if ( isoa ) {
315316 if ( isoa . charCodeAt ( 0 ) <= 57 ) { // starts with digit
316- territoryAlphaCode = parentname2 ( isoa . charCodeAt ( 0 ) - 48 ) + '-' + isoa . substring ( 1 ) ;
317+ territoryAlphaCode = parentname2 ( isoa . charCodeAt ( 0 ) - 48 ) + '-' + isoa . substring ( 1 ) ;
317318 } else {
318319 territoryAlphaCode = isoa ;
319320 }
@@ -438,11 +439,11 @@ function getTerritoryAlphaCode(territory, format) {
438439 }
439440 var full = iso3166alpha [ territoryNumber ] ;
440441 var hyphen = full . indexOf ( "-" ) ;
441- if ( format == 1 || hyphen <= 0 ) {
442+ if ( format == 1 || hyphen <= 0 ) {
442443 return full ;
443444 }
444- var short = full . substr ( hyphen + 1 ) ;
445- if ( format == 0 ) {
445+ var short = full . substr ( hyphen + 1 ) ;
446+ if ( format == 0 ) {
446447 return short ;
447448 }
448449 // shortest POSSIBLE
@@ -454,7 +455,7 @@ function getTerritoryAlphaCode(territory, format) {
454455 count = 2 ;
455456 } else {
456457 for ( i = 0 ; i < iso3166alpha . length ; i ++ ) {
457- if ( iso3166alpha [ i ] . indexOf ( "-" + short ) > 0 ) {
458+ if ( iso3166alpha [ i ] . indexOf ( "-" + short ) > 0 ) {
458459 count ++ ;
459460 }
460461 }
@@ -1139,7 +1140,7 @@ var asc2lan = [
11391140 [ 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
11401141 [ 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
11411142 [ 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
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
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
11431144]
11441145
11451146
@@ -1182,7 +1183,7 @@ var lanlannam = [
11821183 [ "кириллица" ] ,
11831184 [ "עִבְרִית" ] ,
11841185 [ "देवनागरी" ] , // Devanagari
1185- [ "മലയാളം" ] , // Malayalam
1186+ [ "മലയാളം" ] , // Malayalam
11861187 [ "ქართული" ] ,
11871188 [ "カタカナ" ] ,
11881189 [ "ภาษาไทย" ] ,
@@ -1194,8 +1195,8 @@ var lanlannam = [
11941195 [ "العَرَبِيَّة" ] ,
11951196 [ "조선글/한글" ] , // Korean (Choson'gul / Hangul )
11961197 [ "မြန်မာအက္ခရာ" ] , // Burmese
1197- [ "អក្សរខ្មែរ" ] , // Khmer script
1198- [ 'සිංහල අක්ෂර මාලාව' ] , // Sinhalese
1198+ [ "អក្សរខ្មែរ" ] , // Khmer script
1199+ [ 'සිංහල අක්ෂර මාලාව' ] , // Sinhalese
11991200 [ "ތާނަ" ] , // Thaana (Maldivan)
12001201 [ "ㄅㄆㄇㄈ" ] , // Chinese (bopomofo) // 注音符號,
12011202 [ "ⵜⵉⴼⵉⵏⴰⵖ" ] , // Tifinagh (Berber)
0 commit comments