mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-20 17:11:17 -08:00
ran formatter fixed lint issues, primarily getting rid of "any"s and swapping to .toSorted()
20 lines
572 B
TypeScript
20 lines
572 B
TypeScript
import type { SearchItemStrGetter } from '$hooks/useAsyncSearch';
|
|
import { PackImageReader } from './custom-emoji';
|
|
import type { IEmoji } from './emoji';
|
|
|
|
export const getEmoticonSearchStr: SearchItemStrGetter<PackImageReader | IEmoji> = (item) => {
|
|
const shortcode = `:${item.shortcode}:`;
|
|
if (item instanceof PackImageReader) {
|
|
if (item.body) {
|
|
return [shortcode, item.body];
|
|
}
|
|
return shortcode;
|
|
}
|
|
|
|
const names = [shortcode, item.label];
|
|
if (Array.isArray(item.shortcodes)) {
|
|
return names.concat(item.shortcodes);
|
|
}
|
|
return names;
|
|
};
|