Skip to content

Commit d8c0887

Browse files
committed
semver fixes
1 parent 809eb1a commit d8c0887

1 file changed

Lines changed: 24 additions & 10 deletions

File tree

public/minecraft_semver.js

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,8 @@ function normalizeReleaseOrOldVersion(version) {
394394
prepl.push(".0");
395395
}
396396

397-
prepl.push('.').push(trail);
397+
prepl.push('.');
398+
prepl.push(trail);
398399
}
399400
} else if ((matches = matchExact(version, ALPHA_PATTERN)) != null) { // Alpha v1.0.1, Alpha 1.0.1_01, a1.1.0-131933, a1.2.3_05, Alpha 0.1.0, a0.2.8
400401
let trail = matches[2];
@@ -407,7 +408,8 @@ function normalizeReleaseOrOldVersion(version) {
407408
// in the launcher manifest, some Alpha versions have
408409
// trailing alphabetic chars
409410
if (trail != null) {
410-
prepl.push('.').push(trail);
411+
prepl.push('.');
412+
prepl.push(trail);
411413
}
412414
} else if ((matches = matchExact(version, INDEV_PATTERN)) != null) { // Indev 0.31 200100110, in-20100124-2310, Infdev 0.31 20100227-1433, inf-20100611
413415
let date = matches[1];
@@ -416,17 +418,20 @@ function normalizeReleaseOrOldVersion(version) {
416418

417419
prepl.push("0.31.");
418420
prepl.push(date);
419-
if (time != null) prepl.push('-').push(time);
421+
if (time != null) {
422+
prepl.push('-');
423+
prepl.push(time);
424+
}
420425
} else if ((matches = matchExact(version, EARLY_CLASSIC_PATTERN)) != null // c0.0.11a, c0.0.17a-2014, 0.0.18a_02
421426
|| (matches = matchExact(version, LATE_CLASSIC_PATTERN)) != null) { // c0.24_st, 0.24_st_03, 0.25_st-1658, c0.25_05_st, 0.29, c0.30-s, 0.30-c-renew
422-
let late = LATE_CLASSIC_PATTERN.matcher(version).matches();
427+
let late = matchExact(version, LATE_CLASSIC_PATTERN) != null;
423428

424429
let minor = matches[1];
425430
let patch = matches[2];
426431
let trail = late ? matches[4] : null;
427432
let type = late ? matches[5] : null;
428-
timestamp = matches.group(late ? 6 : 3);
429-
suffix = matches.group(late ? 7 : 4);
433+
timestamp = matches[late ? 6 : 3];
434+
suffix = matches[late ? 7 : 4];
430435

431436
// in late classic, sometimes the patch number appears before
432437
// the survival test identifier (_st), and sometimes after it
@@ -436,11 +441,20 @@ function normalizeReleaseOrOldVersion(version) {
436441

437442
prepl.push("0.");
438443
prepl.push(minor);
439-
if (patch != null) prepl.push('.').push(patch);
444+
if (patch != null) {
445+
prepl.push('.');
446+
prepl.push(patch);
447+
}
440448
// in the launcher manifest, some Classic versions have trailing alphabetic chars
441-
if (trail != null) prepl.push('-').push(trail);
449+
if (trail != null) {
450+
prepl.push('-');
451+
prepl.push(trail);
452+
}
442453
// in the Omniarchive manifest, some classic versions releases for creative and survival
443-
if (type != null) prepl.push('-').push(type);
454+
if (type != null) {
455+
prepl.push('-');
456+
prepl.push(type);
457+
}
444458
} else if ((matches = matchExact(version, CLASSIC_SERVER_PATTERN)) != null) {
445459
let release = matches[1];
446460
timestamp = matches[2];
@@ -452,7 +466,7 @@ function normalizeReleaseOrOldVersion(version) {
452466
suffix = matches[2];
453467

454468
// account for a weird exception to the pre-classic versioning scheme
455-
if ("20090515".equals(build)) {
469+
if (build == "20090515") {
456470
build = "150000";
457471
}
458472

0 commit comments

Comments
 (0)