mirror of
https://github.com/daniel-j/fimfic2epub.git
synced 2024-09-28 07:11:16 +12:00
13 lines
272 B
JavaScript
13 lines
272 B
JavaScript
|
import htmlToText from 'html-to-text'
|
||
|
import matchWords from 'match-words'
|
||
|
|
||
|
export default function htmlWordCount (html) {
|
||
|
let text = htmlToText.fromString(html, {
|
||
|
wordwrap: false,
|
||
|
ignoreImage: true,
|
||
|
ignoreHref: true
|
||
|
})
|
||
|
|
||
|
return matchWords(text).length
|
||
|
}
|