replace text only when text is valid

cc @arturi
This commit is contained in:
Ifedapo Olarewaju 2019-03-14 14:32:22 +01:00
parent 9788d26286
commit 985fd62ed6

View file

@ -38,7 +38,7 @@ exports.jsonStringify = (data) => {
* @param {string} text
*/
exports.sanitizeHtml = (text) => {
return text.replace(/<\/?[^>]+(>|$)/g, '')
return text ? text.replace(/<\/?[^>]+(>|$)/g, '') : text
}
/**