Memoize getHTMLText

pull/268/head 2023.10.19.0cf7d68
Lim Chee Aun 2023-10-19 22:57:56 +08:00
rodzic 861619ce57
commit 66fa6fbe52
1 zmienionych plików z 3 dodań i 1 usunięć

Wyświetl plik

@ -1,3 +1,5 @@
import mem from './mem';
const div = document.createElement('div');
function getHTMLText(html) {
if (!html) return '';
@ -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);