mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-23 00:56:23 +01:00
Memoize getHTMLText
This commit is contained in:
parent
861619ce57
commit
66fa6fbe52
1 changed files with 3 additions and 1 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue