UNPKG

cjke-strings

Version:

a set of Chinese Japanese Korean and Emoji strings helpers

4 lines (3 loc) 155 B
export function unicodeEscape(str: string) { return str.replace(/[\s\S]/g, (escape) => `\\u${(`0000${escape.charCodeAt(0).toString(16)}`).slice(-4)}`); }