summary refs log tree commit diff homepage
path: root/src/lib
diff options
context:
space:
mode:
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, '')