9 lines
284 B
TypeScript
9 lines
284 B
TypeScript
// todo optimize
|
|
|
|
export function decodeEmojis(text: string | undefined): string {
|
|
if (!text) return "";
|
|
const regex = /\\u{([^}]+)}/g;
|
|
const decodedText = text.replace(regex, (_: string, hex: string) => String.fromCodePoint(parseInt(hex, 16)));
|
|
return decodedText;
|
|
}
|