summary refs log tree commit diff homepage
path: root/src/lib/util.ts
blob: bd9479509f87985c90cef536bec65ad01c0879d6 (plain) (blame)
1
2
3
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, '')