characters-counter
v1.0.2
Published
The fastest real-time characters, words, sentences, paragraphs counter for your text.
Downloads
222
Maintainers
Readme
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));