Skip to content

Commit

Permalink
Memoize getHTMLText
Browse files Browse the repository at this point in the history
  • Loading branch information
cheeaun committed Oct 19, 2023
1 parent 861619c commit 66fa6fb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/utils/getHTMLText.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import mem from './mem';

const div = document.createElement('div');
function getHTMLText(html) {
if (!html) return '';
Expand All @@ -10,4 +12,4 @@ function getHTMLText(html) {
return div.innerText.replace(/[\r\n]{3,}/g, '\n\n').trim();
}

export default getHTMLText;
export default mem(getHTMLText);

0 comments on commit 66fa6fb

Please sign in to comment.