reorganize code into smaller files & dirs
This commit is contained in:
12
packages/app/src/Utils/emoji-search.ts
Normal file
12
packages/app/src/Utils/emoji-search.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import { matchSorter } from "match-sorter";
|
||||
|
||||
export default async function searchEmoji(key: string) {
|
||||
const emoji = await import("emojilib");
|
||||
/* build proper library with included name of the emoji */
|
||||
const library = Object.entries(emoji).map(([emoji, keywords]) => ({
|
||||
name: keywords[0],
|
||||
keywords,
|
||||
char: emoji,
|
||||
}));
|
||||
return matchSorter(library, key, { keys: ["keywords"] });
|
||||
}
|
Reference in New Issue
Block a user