CHange for with map
parent
bd7469415a
commit
2b1ab96da5
|
@ -90,7 +90,7 @@ async function main() {
|
||||||
);
|
);
|
||||||
|
|
||||||
// Get game data
|
// Get game data
|
||||||
for (const gamename of gameList) {
|
gameList.map(async (gamename) => {
|
||||||
console.log(`Searching '${gamename}'...`);
|
console.log(`Searching '${gamename}'...`);
|
||||||
|
|
||||||
// Prepare the query
|
// Prepare the query
|
||||||
|
@ -103,14 +103,11 @@ async function main() {
|
||||||
const searchResult = await searchHandiwork<Game>(query, 1);
|
const searchResult = await searchHandiwork<Game>(query, 1);
|
||||||
|
|
||||||
// No game found
|
// No game found
|
||||||
if (searchResult.length === 0) {
|
if (searchResult.length !== 0) {
|
||||||
console.log(`No data found for '${gamename}'\n`);
|
// Extract first game
|
||||||
continue;
|
const gamedata = searchResult.shift();
|
||||||
}
|
const authors = gamedata.authors.map((a, idx) => a.name).join(", ");
|
||||||
|
console.log(`Found: ${gamedata.name} (${gamedata.version}) by ${authors}\n`);
|
||||||
// Extract first game
|
} else console.log(`No data found for '${gamename}'\n`);
|
||||||
const gamedata = searchResult.shift();
|
});
|
||||||
const authors = gamedata.authors.map((a, idx) => a.name).join(", ");
|
|
||||||
console.log(`Found: ${gamedata.name} (${gamedata.version}) by ${authors}\n`);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue