npm install --save count-words-occurrence
Import the module in your application:
// From ES6
import countWords from 'count-words-occurrence'
// From CJS
const countWords = require('count-words-occurrence');
// From global
const countWords = countWordsOccurrence.default;
// Then use it juste like that:
const result = countWords(input, options);
countWords(input, options);
Type: string
Type: boolean
| default: false
Type: number
| default: 2
The minimum length of words to count.
Type: Array<(x: string) => boolean>
| default: []
An array of functions to apply to each word for enable custom filters.
npm test