Text Formatter-js-v
🚀 A simple and efficient npm package for text manipulation: uppercase, lowercase, Title Case, and URL-friendly slugs.
📦 Installation
Install the package via npm:
npm install text-formatter-js-v
🔧 Usage
Import the module into your project and use the functions:
const { toUpperCase, toLowerCase, toTitleCase, toSlug } = require("text-formatter-js-v");
console.log(toUpperCase("hello world")); // "HELLO WORLD"
console.log(toLowerCase("Hello World")); // "hello world"
console.log(toTitleCase("hello world")); // "Hello World"
console.log(toSlug("Bonjour le monde !")); // "bonjour-le-monde"
🛠 API Functions
toUpperCase(str)
Converts a string to uppercase.
toLowerCase(str)
Converts a string to lowercase.
toTitleCase(str)
Converts a string to Title Case (Each word starts with a capital letter).
toSlug(str)
Generates a URL-friendly slug:
- Removes accents
- Converts to lowercase
- Replaces spaces with hyphens
- Removes special characters
🧪 Tests
This package is tested with Jest. To run the tests:
npm test
📜 License
MIT License - [Terra Vidhal]
🎉 Have fun with text-formatter
!