Return 0 if no html

This commit is contained in:
Lim Chee Aun 2022-12-19 17:30:10 +08:00
parent db25770a31
commit 509c1d971e

View file

@ -1,5 +1,6 @@
const div = document.createElement('div');
export default function htmlContentLength(html) {
if (!html) return 0;
div.innerHTML = html;
return div.innerText.length;
}