From 78248aea26de5d2c242c401c373bda8bdcec4b20 Mon Sep 17 00:00:00 2001 From: taichi221228 Date: Thu, 2 May 2024 13:38:48 +0900 Subject: [PATCH] Refactor intersect function in emoji_utils.ts This commit refactors the intersect function in the emoji_utils.ts file. The `a` and `b` parameters are more explicitly defined as empty arrays, and the indexOf method is replaced with the includes method for better readability and performance. Additionally, the placement of the eslint-disable directive has been adjusted to improve linting results. --- app/javascript/mastodon/features/emoji/emoji_utils.ts | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/javascript/mastodon/features/emoji/emoji_utils.ts b/app/javascript/mastodon/features/emoji/emoji_utils.ts index 41745318352..ce30e711ade 100644 --- a/app/javascript/mastodon/features/emoji/emoji_utils.ts +++ b/app/javascript/mastodon/features/emoji/emoji_utils.ts @@ -209,16 +209,15 @@ function uniq(arr: []) { }, []); } -/* eslint-disable */ - -// @ts-expect-error -function intersect(a, b) { +function intersect(a: [], b: []) { const uniqA = uniq(a); const uniqB = uniq(b); - return uniqA.filter((item) => uniqB.indexOf(item) >= 0); + return uniqA.filter((item) => uniqB.includes(item)); } +/* eslint-disable */ + // @ts-expect-error function deepMerge(a, b) { let o = {};