fix: emoji render function (#1484)

* fix: emoji render function

* fix: emoji render function
This commit is contained in:
Aaryan Khandelwal 2023-07-06 16:08:49 +05:30 committed by GitHub
parent 3a2f4d55d7
commit 49f37e0346
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 40 additions and 30 deletions

View file

@ -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)];
};

View 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));
};