Skip to content

Commit

Permalink
fix: return '' if !content
Browse files Browse the repository at this point in the history
  • Loading branch information
at-wr committed Mar 2, 2024
1 parent 6e7f20f commit 6106e4f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions components/custom/cleanHTML.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ export function cleanHTML(content: string): string

// Define
export function cleanHTML(content: string): string {
if (!content) {
return '';
}

return content.replace(/<script[^>]*>([\s\S]*?)<\/script>/gmi, '')
.replace(/<style[^>]*>([\s\S]*?)<\/style>/gmi, '')
}

0 comments on commit 6106e4f

Please sign in to comment.