diff options
author | destruc7i0n <destruc7i0n@users.noreply.github.com> | 2021-12-29 16:39:46 -0500 |
---|---|---|
committer | destruc7i0n <destruc7i0n@users.noreply.github.com> | 2021-12-29 16:39:46 -0500 |
commit | a04d39a3cbf10e7335889615a36a78827857b566 (patch) | |
tree | ab132aeeb0e931e1131c1a46182a9cb5a7e882e5 /src/lib | |
parent | added config option for watchFile (diff) | |
download | shulker-a04d39a3cbf10e7335889615a36a78827857b566.tar.gz shulker-a04d39a3cbf10e7335889615a36a78827857b566.zip |
escape unicode characters
closes #76
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/util.ts | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/lib/util.ts b/src/lib/util.ts new file mode 100644 index 0000000..bd94795 --- /dev/null +++ b/src/lib/util.ts @@ -0,0 +1,4 @@ +export const escapeUnicode = (str: string) => + str.replace(/[^\x00-\x7F]/g, (char: string) => '\\u' + char.charCodeAt(0).toString(16).padStart(4, '0')) + +export const fixMinecraftUsername = (username: string) => username.replace(/(ยง[A-Z-a-z0-9])/g, '') |