1
0
Fork 0
mirror of https://github.com/mastodon/mastodon.git synced 2024-08-20 21:08:15 -07:00

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.
This commit is contained in:
taichi221228 2024-05-02 13:38:48 +09:00
parent 33bd4e67e9
commit 78248aea26

View file

@ -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 = {};