🎨 String trimSpecial pass string OR undefined

This commit is contained in:
Flam3rboy 2021-04-24 11:14:17 +02:00
parent 92fcdc2a0b
commit 2c39b659a5
2 changed files with 3 additions and 1 deletions

1
.npmignore Normal file
View File

@ -0,0 +1 @@
!dist/

View File

@ -1,5 +1,6 @@
import { DOUBLE_WHITE_SPACE, SPECIAL_CHAR } from "./Regex"; 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(); return str.replace(SPECIAL_CHAR, "").replace(DOUBLE_WHITE_SPACE, " ").trim();
} }