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