8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a26e0bc commit 8d0d28eCopy full SHA for 8d0d28e
src/utils/html.js
@@ -1,9 +1,9 @@
1
-const stripTagsRegex = /(<([^>]+)>)/gi
+const RX_HTML_TAGS = /(<([^>]+)>)/gi
2
3
-// Removes any thing that looks like an HTML tag from the supplied string
4
-export const stripTags = (text = '') => String(text).replace(stripTagsRegex, '')
+// Removes anything that looks like an HTML tag from the supplied string
+export const stripTags = (text = '') => String(text).replace(RX_HTML_TAGS, '')
5
6
-// Generate a domProps object for either innerHTML, textContent or nothing
+// Generate a `domProps` object for either `innerHTML`, `textContent` or an empty object
7
export const htmlOrText = (innerHTML, textContent) => {
8
return innerHTML ? { innerHTML } : textContent ? { textContent } : {}
9
}
0 commit comments