From d47abd205bffb21bc8cd5f89d89b7890b6154967 Mon Sep 17 00:00:00 2001 From: yayuyokitano <69117606+yayuyokitano@users.noreply.github.com> Date: Tue, 24 Nov 2020 00:23:56 +0800 Subject: [PATCH] cleaning --- src/classes/helper.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/classes/helper.ts b/src/classes/helper.ts index 0648c24b..00f56426 100644 --- a/src/classes/helper.ts +++ b/src/classes/helper.ts @@ -141,9 +141,8 @@ export default class HelperClass { if (detailTypes !== []) { const res = await this.fetchDetails(usernameOrSessionKey, detailTypes, artist, album, track); - console.log(res); - const exists = res.map(e => e.error === undefined); + const exists = res.map((e) => typeof e.error === "undefined"); let i = 0; @@ -173,7 +172,7 @@ export default class HelperClass { nowplaying }, details - } + }; } @@ -206,13 +205,13 @@ export default class HelperClass { let promises:Promise[] = []; if (detailTypes?.includes("artist")) { - promises.push(this.lastfm.artist.getInfo({artist}, {username: usernameOrSessionKey}).catch(err => {})); + promises.push(this.lastfm.artist.getInfo({artist}, {username: usernameOrSessionKey}).catch((err) => {})); } if (detailTypes?.includes("album") && album) { - promises.push(this.lastfm.album.getInfo({artist, album}, {username: usernameOrSessionKey}).catch(err => {})); + promises.push(this.lastfm.album.getInfo({artist, album}, {username: usernameOrSessionKey}).catch((err) => {})); } if (detailTypes?.includes("track")) { - promises.push(this.lastfm.track.getInfo({artist, track}, {username: usernameOrSessionKey}).catch(err => {})); + promises.push(this.lastfm.track.getInfo({artist, track}, {username: usernameOrSessionKey}).catch((err) => {})); } return await Promise.all(promises);