mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-03-23 14:13:21 +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');
|
const div = document.createElement('div');
|
||||||
function getHTMLText(html) {
|
function getHTMLText(html) {
|
||||||
if (!html) return '';
|
if (!html) return '';
|
||||||
|
@ -10,4 +12,4 @@ function getHTMLText(html) {
|
||||||
return div.innerText.replace(/[\r\n]{3,}/g, '\n\n').trim();
|
return div.innerText.replace(/[\r\n]{3,}/g, '\n\n').trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default getHTMLText;
|
export default mem(getHTMLText);
|
||||||
|
|
Loading…
Add table
Reference in a new issue