Reduce cyclomatic complexity
parent
f0caf0f669
commit
46a0afca70
|
@ -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;
|
||||
};
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue