Reduce cyclomatic complexity

pull/59/head
MillenniumEarl 2020-12-15 14:09:16 +01:00
parent f0caf0f669
commit 46a0afca70
3 changed files with 8 additions and 8 deletions

View File

@ -119,17 +119,16 @@ module.exports.getGameData = async function (name, mod) {
}
// Gets the search results of the game/mod being searched for
let urls = [];
if(mod) urls = await searcher.searchMod(name);
else urls = await searcher.searchGame(name);
const urls = mod ?
await searcher.searchMod(name) :
await searcher.searchGame(name);
// Process previous partial results
const results = [];
for (const url of urls) {
// Start looking for information
const info = await scraper.getGameInfo(url);
if(!info) continue;
results.push(info);
if (info) results.push(info);
}
return results;
};

View File

@ -10,6 +10,10 @@ class Credentials {
this.token = null;
}
/**
* @public
* Fetch and save the token used to log in to F95Zone.
*/
async fetchToken() {
this.token = await getF95Token();
}

View File

@ -29,9 +29,6 @@ class PrefixParser {
* @returns {String[]}
*/
_toUpperCaseArray(a) {
// If the array is empty, return
if (a.length === 0) return [];
/**
* Makes a string uppercase.
* @param {String} s