fix: emoji render function (#1484)
* fix: emoji render function * fix: emoji render function
This commit is contained in:
parent
3a2f4d55d7
commit
49f37e0346
8 changed files with 40 additions and 30 deletions
|
|
@ -16,23 +16,3 @@ export const debounce = (func: any, wait: number, immediate: boolean = false) =>
|
|||
if (callNow) func(...args);
|
||||
};
|
||||
};
|
||||
|
||||
export const getRandomEmoji = () => {
|
||||
const emojis = [
|
||||
"8986",
|
||||
"9200",
|
||||
"128204",
|
||||
"127773",
|
||||
"127891",
|
||||
"127947",
|
||||
"128076",
|
||||
"128077",
|
||||
"128187",
|
||||
"128188",
|
||||
"128512",
|
||||
"128522",
|
||||
"128578",
|
||||
];
|
||||
|
||||
return emojis[Math.floor(Math.random() * emojis.length)];
|
||||
};
|
||||
|
|
|
|||
25
apps/app/helpers/emoji.helper.ts
Normal file
25
apps/app/helpers/emoji.helper.ts
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
export const getRandomEmoji = () => {
|
||||
const emojis = [
|
||||
"8986",
|
||||
"9200",
|
||||
"128204",
|
||||
"127773",
|
||||
"127891",
|
||||
"127947",
|
||||
"128076",
|
||||
"128077",
|
||||
"128187",
|
||||
"128188",
|
||||
"128512",
|
||||
"128522",
|
||||
"128578",
|
||||
];
|
||||
|
||||
return emojis[Math.floor(Math.random() * emojis.length)];
|
||||
};
|
||||
|
||||
export const renderEmoji = (emoji: string) => {
|
||||
if (!emoji) return;
|
||||
|
||||
return isNaN(parseInt(emoji)) ? emoji : String.fromCodePoint(parseInt(emoji));
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue