A very powerful words counter that supports plain text and html.
# Using npm
npm install --save word-counting
# Using yarn
yarn add word-counting
Inject the library in your file:
// javascript
var wordsCounter = require('word-counting')
// typescript
import wordsCounter from 'word-counting'
Count the words for plain text:
const mockedText = 'These are some mocked words.'
console.log(wordsCounter(mockedText).wordsCount) // 5
Count the words for html:
const mockedText = '<p>These are some mocked words with html format</p>'
console.log(wordsCounter(mockedText, { isHtml: true }).wordsCount) // 8
Feel free to make any improvements or changes. Any changes will be appreciated and I'll add you to the contributors list below. :)
git checkout -b feature/fooBar
)git add .
)yarn commit
). NOTE: This repo is following the conventional commits, and yarn commit
is the easiest way to construct the commit message.git push origin feature/fooBar
)Max Liu 💻 📖 🚇 ⚠️ |
Pepe Sosa 🐛 |
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Generated using TypeDoc
The function that can count the words occurrence in text