check the value of remove puntuation

This commit is contained in:
Elio Struyf
2021-10-17 15:28:05 +02:00
parent 380e40ea05
commit 82a22da90a
+2 -2
View File
@@ -30,9 +30,9 @@ export class SlugHelper {
* @param value
*/
private static removePunctuation(value: string): string {
const punctuationless = value.replace(/[\.,-\/#!$@%\^&\*;:{}=\-_`'"~()+\?<>]/g, " ");
const punctuationless = value?.replace(/[\.,-\/#!$@%\^&\*;:{}=\-_`'"~()+\?<>]/g, " ");
// Remove double spaces
return punctuationless.replace(/\s{2,}/g," ");
return punctuationless?.replace(/\s{2,}/g," ");
}
/**