@dashdashzako/count-words

2.0.2 • Public • Published

Count Words

The problem

Implement a function that returns an object with words as keys and occurencies countWords(string, n) as values for each word longer than n.

The solution

  1. Do not handle non string parameter
  2. From a text that can be of any shape (single, multiline)
  3. Separate all words
  4. Filter them by length
  5. Initialise or increment the count key in the final object

Install and run

npm install @dashdashzako/word-count
import countWords from 'count-words';

const theText = 'Hello, World!';

console.log(JSON.stringify(theText));

// { hello: 1, world: 1 }

Readme

Keywords

none

Package Sidebar

Install

npm i @dashdashzako/count-words

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

5.15 kB

Total Files

5

Last publish

Collaborators

  • dashdashzako