Skip to content

Commit 1bcd448

Browse files
committed
Revert "Release 2.4.0"
This reverts commit c3d82e3.
1 parent c3d82e3 commit 1bcd448

File tree

2 files changed

+34
-31
lines changed

2 files changed

+34
-31
lines changed

README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,15 @@ 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; Fixed Bengali to also support Assamese.
60+
Improved some characters for Arabic and Devanagari.
61+
62+
Fixed Bengali to also support Assamese.
6163

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

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

6668
* 2.3.1
6769

mapcode.js

Lines changed: 28 additions & 27 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,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
["&#1082;&#1080;&#1088;&#1080;&#1083;&#1083;&#1080;&#1094;&#1072;"],
11831184
["&#1506;&#1460;&#1489;&#1456;&#1512;&#1460;&#1497;&#1514;"],
11841185
["&#2342;&#2375;&#2357;&#2344;&#2366;&#2327;&#2352;&#2368;"], // Devanagari
1185-
["&#3374;&#3378;&#3375;&#3390;&#3379;&#3330;"], // Malayalam
1186+
["&#3374;&#3378;&#3375;&#3390;&#3379;&#3330;"], // Malayalam
11861187
["&#4325;&#4304;&#4320;&#4311;&#4323;&#4314;&#4312;"],
11871188
["&#12459;&#12479;&#12459;&#12490;"],
11881189
["&#3616;&#3634;&#3625;&#3634;&#3652;&#3607;&#3618;"],
@@ -1194,8 +1195,8 @@ var lanlannam = [
11941195
["&#1575;&#1604;&#1593;&#1614;&#1585;&#1614;&#1576;&#1616;&#1610;&#1614;&#1617;&#1577;"],
11951196
["&#51312;&#49440;&#44544;/&#54620;&#44544;"], // Korean (Choson'gul / Hangul )
11961197
["&#4121;&#4156;&#4116;&#4154;&#4121;&#4140;&#4129;&#4096;&#4153;&#4097;&#4123;&#4140;"], // Burmese
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
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
11991200
["&#1932;&#1959;&#1922;&#1958;"], // Thaana (Maldivan)
12001201
["&#12549;&#12550;&#12551;&#12552;"], // Chinese (bopomofo) // &#27880;&#38899;&#31526;&#34399;,
12011202
["&#11612;&#11593;&#11580;&#11593;&#11599;&#11568;&#11606"], // Tifinagh (Berber)

0 commit comments

Comments
 (0)