From 1dd57954b03ee94f241f61f3a9f4e6892dbf8f23 Mon Sep 17 00:00:00 2001 From: MillenniumEarl Date: Mon, 2 Nov 2020 18:47:24 +0100 Subject: [PATCH] Added comment --- app/scripts/scraper.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/scripts/scraper.js b/app/scripts/scraper.js index 2c0fa15..7f20b30 100644 --- a/app/scripts/scraper.js +++ b/app/scripts/scraper.js @@ -126,14 +126,13 @@ function extractInfoFromTitle(body) { }); name = name.trim(); - // The regex [[\]]+ remove the square brackets - // The version is the penultimate element. // If the matches are less than 2, than the title // is malformes and only the author is fetched // (usually the author is always present) let version = null; if (matches.length >= 2) { + // The regex [[\]]+ remove the square brackets version = matches[matches.length - 2].replace(/[[\]]+/g, "").trim(); // If the version is in the format v1.0 remove the "v" @@ -146,7 +145,7 @@ function extractInfoFromTitle(body) { } else shared.logger.trace(`Malformed title: ${title}`); - // Last element + // Last element (the regex [[\]]+ remove the square brackets) const author = matches[matches.length - 1].replace(/[[\]]+/g, "").trim(); return {