Created
May 3, 2022 02:54
-
-
Save cindywu/4284ac7d05871727e4ed59c5089a7f55 to your computer and use it in GitHub Desktop.
htmlToText
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function htmlToText(html: string) { | |
return html && html.replace(/<[^>]+>/g, '').replace(/ /g, ` `) || '' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://www.digitalocean.com/community/tutorials/replace-all-instances-of-a-string-in-javascript