simple-case-converter
v1.1.0
Published
A lightweight utility for converting strings to sentence case or capitalized word format.
Downloads
135
Maintainers
Readme
Simple Case Converter
A lightweight utility for converting strings into sentence case or capitalized word format. Built with simplicity, predictability, and zero dependencies in mind.
✨ Features
- Convert text to sentence case
- Capitalize each word
- Optional period handling
- Input validation
- Zero dependencies
- Lightweight & easy to use
📦 Installation
npm install simple-case-converter🚀 Usage
const { sentenceCase, capitalizeEachWord } = require('simple-case-converter');
// Sentence case
console.log(sentenceCase('hello world'));
// "Hello world"
// Sentence case with period
console.log(sentenceCase('hello world', { period: true }));
// "Hello world."
// Capitalize each word
console.log(capitalizeEachWord('hello world'));
// "Hello World"
// Capitalize each word with period
console.log(capitalizeEachWord('hello world', { period: true }));
// "Hello World."⚠ Error Handling
Throws a TypeError if the input is not a string.
sentenceCase(123);
// TypeError: Parameter must be a string📄 License
MIT
