text-utils-kit
v1.0.0
Published
A lightweight JavaScript utility library for text processing and formatting.
Maintainers
Readme
text-utils-js
A lightweight JavaScript utility library for text processing and formatting.
Features
- Count words in a string
- Count characters in a string
- Remove extra spaces
- Capitalize the first letter of a string
- Generate URL-friendly slugs
Installation
npm install text-utils-kitUsage
const textUtils = require("text-utils-kit");;
console.log(textUtils.wordCount("Hello World"));
// 2
console.log(textUtils.charCount("Hello"));
// 5
console.log(textUtils.removeExtraSpaces("Hello World"));
// Hello World
console.log(textUtils.capitalize("adarsh"));
// Adarsh
console.log(textUtils.slugify("My First NPM Package"));
// my-first-npm-packageAPI Reference
wordCount(text)
Returns the total number of words in a string.
textUtils.wordCount("Hello World");Output
2charCount(text)
Returns the total number of characters in a string.
textUtils.charCount("Hello");Output
5removeExtraSpaces(text)
Removes extra spaces from a string.
textUtils.removeExtraSpaces("Hello World");Output
"Hello World"capitalize(text)
Capitalizes the first letter of a string.
textUtils.capitalize("adarsh");Output
"Adarsh"slugify(text)
Converts text into a URL-friendly slug.
textUtils.slugify("My First NPM Package");Output
"my-first-npm-package"Example
const textUtils = require("text-utils-js");
const text = " hello world ";
console.log(textUtils.wordCount(text));
console.log(textUtils.charCount(text));
console.log(textUtils.removeExtraSpaces(text));
console.log(textUtils.capitalize("javascript"));
console.log(textUtils.slugify("JavaScript Utility Package"));Project Structure
text-utils-js/
├── index.js
├── test.js
├── package.json
└── README.mdAuthor
Adarsh Yadav
- GitHub: https://github.com/AdarshYadav-dev
- Repository: https://github.com/AdarshYadav-dev/text-utils-js
License
This project is licensed under the MIT License.
