word-statics

0.1.0 • Public • Published

word-statics Build Status

Get statistics about words in a string! Total words, total unique words and number of iterations for a given word

Install

$ npm install --save word-statics

Usage

const ws = require('word-statics');
 
let string = 'Hello World! Hello World! Hello World!';
let x = ws(string);
 
// Returns an object
// => x = {
// words: {
// hello: 3,
// world: 3
// },
// stats: {
// totalWords: 6,
// totalUniqueWords: 2
// }
// }
 
x.stats.totalWords; // 6
 
string = "Hello. hello!";
= ws(string, true); // Case sensitive = true (false by default)
 
// Returns an object
// => x = {
// words: {
// hello: 1,
// Hello: 1
// },
// stats: {
// totalWords: 2,
// totalUniqueWords: 2
// }
// }
 

Testing

$ npm test

License

MIT © EL AZZABI Ahmed

/word-statics/

    Package Sidebar

    Install

    npm i word-statics

    Weekly Downloads

    1

    Version

    0.1.0

    License

    MIT

    Last publish

    Collaborators

    • elazzabi