aboutsummaryrefslogtreecommitdiff
path: root/src/lib/utils.ts
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-02-17 19:12:57 +0000
committermat <github@matdoes.dev>2022-02-17 19:12:57 +0000
commitbad8a1f2c7519ef63350c26b539dfc6aeb9ab94c (patch)
treea129569b5feb80fcc23578de4143865f1d0937f1 /src/lib/utils.ts
parent07666cc5be0309fad63435b9604e786cd57c9ad8 (diff)
downloadskyblock-stats-bad8a1f2c7519ef63350c26b539dfc6aeb9ab94c.tar.gz
skyblock-stats-bad8a1f2c7519ef63350c26b539dfc6aeb9ab94c.tar.bz2
skyblock-stats-bad8a1f2c7519ef63350c26b539dfc6aeb9ab94c.zip
add items
Diffstat (limited to 'src/lib/utils.ts')
-rw-r--r--src/lib/utils.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index ae0c5f0..f16021d 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -68,8 +68,11 @@ export function formattingCodeToHtml(formatted: string): string {
reset()
return htmlOutput
}
+
+// we store the regex here so we don't have to build the object every time
+const formattingCodeRegex = new RegExp(colorCodeCharacter + '.', 'g')
export function removeFormattingCode(formatted: string): string {
- return formatted.replace(new RegExp(colorCodeCharacter + '.', 'g'), '')
+ return formatted.replace(formattingCodeRegex, '')
}
function moveToEndOfId(word: string, thing: string) {