summary refs log tree commit diff homepage
path: root/src/lib
diff options
context:
space:
mode:
authordestruc7i0n <destruc7i0n@users.noreply.github.com>2021-12-29 16:39:46 -0500
committerdestruc7i0n <destruc7i0n@users.noreply.github.com>2021-12-29 16:39:46 -0500
commita04d39a3cbf10e7335889615a36a78827857b566 (patch)
treeab132aeeb0e931e1131c1a46182a9cb5a7e882e5 /src/lib
parentadded config option for watchFile (diff)
downloadshulker-a04d39a3cbf10e7335889615a36a78827857b566.tar.gz
shulker-a04d39a3cbf10e7335889615a36a78827857b566.zip
escape unicode characters
closes #76
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/util.ts4
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, '')