diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-04-24 11:14:17 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-04-24 11:14:17 +0200 |
commit | 2c39b659a59bb308a1221c1ab949f774ed195e7c (patch) | |
tree | d22e62ed6629b9411480379ae0e48d8770add267 /src/util | |
parent | :bug: fix member model (diff) | |
download | server-2c39b659a59bb308a1221c1ab949f774ed195e7c.tar.xz |
:art: String trimSpecial pass string OR undefined
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/String.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/util/String.ts b/src/util/String.ts index 407b669d..161336f1 100644 --- a/src/util/String.ts +++ b/src/util/String.ts @@ -1,5 +1,6 @@ import { DOUBLE_WHITE_SPACE, SPECIAL_CHAR } from "./Regex"; -export function trimSpecial(str: string) { +export function trimSpecial(str?: string) { + if (!str) return; return str.replace(SPECIAL_CHAR, "").replace(DOUBLE_WHITE_SPACE, " ").trim(); } |