summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/twemoji-base.ts
blob: 638aae3284e862ce1ca0db216631fe7be5db3886 (plain)
1
2
3
4
5
6
7
8
9
10
11
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`;
}