Return null if the sanitization would be empty

This commit is contained in:
Jasmin 2023-07-14 08:59:01 +02:00 committed by GitHub
parent 6e4f0d4969
commit b9fbb9b204
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -136,7 +136,10 @@ function sanitizePronouns(str) {
str = str.replace(/:[\w_]+:/gi, "");
// Finally, remove leading and trailing whitespace.
return str.trim();
str= str.trim();
// If the result is empty, return null, otherwise the empty string.
return str==="" ? null : str;
}
const knownPronouns = [