summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/client/src/scripts')
-rw-r--r--packages/client/src/scripts/twemoji-base.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/client/src/scripts/twemoji-base.ts b/packages/client/src/scripts/twemoji-base.ts
index cd50311b15..638aae3284 100644
--- a/packages/client/src/scripts/twemoji-base.ts
+++ b/packages/client/src/scripts/twemoji-base.ts
@@ -1 +1,12 @@
export const twemojiSvgBase = '/twemoji';
+
+export function char2fileName(char: string): string {
+ let codes = Array.from(char).map(x => x.codePointAt(0)?.toString(16));
+ if (!codes.includes('200d')) codes = codes.filter(x => x !== 'fe0f');
+ codes = codes.filter(x => x && x.length);
+ return codes.join('-');
+}
+
+export function char2filePath(char: string): string {
+ return `${twemojiSvgBase}/${char2fileName(char)}.svg`;
+}