From 8c7b3aa3728853b0eeec11bac66d7ffdd961775d Mon Sep 17 00:00:00 2001 From: stonedDiscord Date: Sun, 8 Jan 2023 20:37:02 +0100 Subject: regex slow and cringe --- webAO/encoding.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'webAO') diff --git a/webAO/encoding.ts b/webAO/encoding.ts index 54770d0..2d1f66f 100644 --- a/webAO/encoding.ts +++ b/webAO/encoding.ts @@ -4,10 +4,10 @@ */ export function escapeChat(estring: string): string { return estring - .replace(/#/g, '') - .replace(/&/g, '') - .replace(/%/g, '') - .replace(/\$/g, ''); + .replace('#', '') + .replace('&', '') + .replace('%', '') + .replace('$', ''); } /** @@ -16,10 +16,10 @@ export function escapeChat(estring: string): string { */ export function unescapeChat(estring: string): string { return estring - .replace(//g, '#') - .replace(//g, '&') - .replace(//g, '%') - .replace(//g, '$'); + .replace('', '#') + .replace('', '&') + .replace('', '%') + .replace('', '$'); } /** @@ -31,8 +31,8 @@ export function unescapeChat(estring: string): string { export function safeTags(unsafe: string): string { if (unsafe) { return unsafe - .replace(/>/g, '>') - .replace(/', '>') + .replace('<', '<'); } return ''; } -- cgit