Skip to content

Commit c3d82e3

Browse files
committed
Release 2.4.0
1 parent b3a5bc4 commit c3d82e3

2 files changed

Lines changed: 31 additions & 34 deletions

File tree

README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,13 @@ To run the Javascript unit tests, simply open the file `unittest/unittest/html`.
5555

5656
Renamed language strings to more correct terms (Malay to Malayalam; Hindi to Devanagari).
5757

58-
Added var `alphabetsForTerritory[t]`, returning the most commonly used alphabets for territory `t`.
58+
Added var alphabetsForTerritory[t], returning the most commonly used alphabets for territory t.
5959

60-
Improved some characters for Arabic and Devanagari.
61-
62-
Fixed Bengali to also support Assamese.
60+
Improved some characters for Arabic and Devanagari; Fixed Bengali to also support Assamese.
6361

64-
For some alphabets, removed recognition of letters `I` and/or `O` unless looking like digits `1` and/or `0`.
62+
For some alphabets, removed recognition of letters I and/or O unless looking like digits 1 and/or 0.
6563

66-
Replaced internal encoded `entity_iso[]` array by non-encoded `iso3166alpha[]`.
64+
replaced internal encoded entity_iso[] array by non-encoded iso3166alpha[].
6765

6866
* 2.3.1
6967

mapcode.js

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
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+
*/
1616
var 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
["&#1082;&#1080;&#1088;&#1080;&#1083;&#1083;&#1080;&#1094;&#1072;"],
11841183
["&#1506;&#1460;&#1489;&#1456;&#1512;&#1460;&#1497;&#1514;"],
11851184
["&#2342;&#2375;&#2357;&#2344;&#2366;&#2327;&#2352;&#2368;"], // Devanagari
1186-
["&#3374;&#3378;&#3375;&#3390;&#3379;&#3330;"], // Malayalam
1185+
["&#3374;&#3378;&#3375;&#3390;&#3379;&#3330;"], // Malayalam
11871186
["&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;"],
11881187
["&#12459;&#12479;&#12459;&#12490;"],
11891188
["&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;"],
@@ -1195,8 +1194,8 @@ var lanlannam = [
11951194
["&#1575;&#1604;&#1593;&#1614;&#1585;&#1614;&#1576;&#1616;&#1610;&#1614;&#1617;&#1577;"],
11961195
["&#51312;&#49440;&#44544;/&#54620;&#44544;"], // Korean (Choson'gul / Hangul )
11971196
["&#4121;&#4156;&#4116;&#4154;&#4121;&#4140;&#4129;&#4096;&#4153;&#4097;&#4123;&#4140;"], // Burmese
1198-
["&#6050;&#6016;&#6098;&#6047;&#6042;&#6017;&#6098;&#6040;&#6082;&#6042;"], // Khmer script
1199-
['&#3523;&#3538;&#3458;&#3524;&#3517; &#3461;&#3482;&#3530;&#3522;&#3515; &#3512;&#3535;&#3517;&#3535;&#3520;'], // Sinhalese
1197+
["&#6050;&#6016;&#6098;&#6047;&#6042;&#6017;&#6098;&#6040;&#6082;&#6042;"], // Khmer script
1198+
['&#3523;&#3538;&#3458;&#3524;&#3517; &#3461;&#3482;&#3530;&#3522;&#3515; &#3512;&#3535;&#3517;&#3535;&#3520;'], // Sinhalese
12001199
["&#1932;&#1959;&#1922;&#1958;"], // Thaana (Maldivan)
12011200
["&#12549;&#12550;&#12551;&#12552;"], // Chinese (bopomofo) // &#27880;&#38899;&#31526;&#34399;,
12021201
["&#11612;&#11593;&#11580;&#11593;&#11599;&#11568;&#11606"], // Tifinagh (Berber)

0 commit comments

Comments
 (0)