Removed trailing "v" in game version

pull/46/head
MillenniumEarl 2020-11-02 17:26:06 +01:00
parent e61b1489df
commit 414c34e917
2 changed files with 12 additions and 2 deletions

View File

@ -133,7 +133,17 @@ function extractInfoFromTitle(body) {
// is malformes and only the author is fetched
// (usually the author is always present)
let version = null;
if (matches.length >= 2) version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim();
if (matches.length >= 2) {
version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim();
// If the version is in the format v1.0 remove the "v"
if (version[0].toUpperCase() === "V" && !isNaN(version[1])) {
const indexOfCharToRemove = 0; // The first letter
const tmp = version.split(""); // Convert to an array
tmp.splice(indexOfCharToRemove, 1); // Remove the first element
version = tmp.join(""); // Reconstruct the version
}
}
else shared.logger.trace(`Malformed title: ${title}`);
// Last element

View File

@ -27,7 +27,7 @@
"scripts": {
"unit-test-mocha": "nyc --reporter=text mocha './test/index-test.js'",
"report-coverage": "nyc report --reporter=text-lcov > coverage.lcov && codecov -t 38ad72bf-a29d-4c2e-9827-96cbe037afd2",
"test": "node ./test/user-test.js",
"run-example": "node ./app/example.js",
"deploy": "npm pack"
},
"engines": {