From 125849673a1aba46021852ee473d00f4520d1bd6 Mon Sep 17 00:00:00 2001 From: Aya Morisawa Date: Tue, 11 Dec 2018 20:36:55 +0900 Subject: Use for-of instead of forEach (#3583) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: syuilo Co-authored-by: Acid Chicken (硫酸鶏) --- src/server/api/endpoints/aggregation/hashtags.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'src/server/api/endpoints/aggregation') diff --git a/src/server/api/endpoints/aggregation/hashtags.ts b/src/server/api/endpoints/aggregation/hashtags.ts index 45d709f772..7577711b5f 100644 --- a/src/server/api/endpoints/aggregation/hashtags.ts +++ b/src/server/api/endpoints/aggregation/hashtags.ts @@ -47,10 +47,7 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { }> = []; // カウント - data.map(x => x._id).forEach(x => { - // ブラックリストに登録されているタグなら弾く - if (hidedTags.includes(x.tag)) return; - + for (const x of data.map(x => x._id).filter(x => !hidedTags.includes(x.tag))) { const i = tags.findIndex(tag => tag.name == x.tag); if (i != -1) { tags[i].count++; @@ -60,7 +57,7 @@ export default define(meta, (ps) => new Promise(async (res, rej) => { count: 1 }); } - }); + } // タグを人気順に並べ替え tags.sort((a, b) => b.count - a.count); -- cgit v1.2.3-freya