characters-counter

1.0.2 • Public • Published

characters-counter

Installation

npm i characters-counter

Usage

Use by calling functions:

  • countChar -> Counts total characters (including spaces).
  • countCharNoSpaces -> Counts total characters (excluding spaces).
  • countWords -> Counts total words.
  • countSpaces -> Counts total spaces.
  • countSentences -> Counts total Sentences.
  • countPara -> Counts total Paragraphs.
import charCount from 'characters-counter';

const inputText = `
    This is a dummy lorem-ipsum text:

    NEW DELHI: Ireland on Friday created history, claiming their first-ever Test win against Afghanistan in Abu Dhabi
    
    The maiden Test win for Ireland came in their 8th game in the traditional format.
    
    Captain Andy Balbirnie led from the front with an undefeated 58 as Ireland won the one-off Test by 6 wickets in the final session on the third day, successfully chasing down a modest target of 111.
`;

console.log("Total characters:", charCount.countChar(inputText));
console.log("Total characters (excluding spaces):", charCount.countCharNoSpaces(inputText));
console.log("Total words:", charCount.countWords(inputText));
console.log("Total spaces:", charCount.countSpaces(inputText));
console.log("Total sentences:", charCount.countSentences(inputText));
console.log("Total paragraphs:", charCount.countPara(inputText));

Package Sidebar

Install

npm i characters-counter

Weekly Downloads

1

Version

1.0.2

License

Apache-2.0

Unpacked Size

16.8 kB

Total Files

5

Last publish

Collaborators

  • anshsinghsonkhia