A tiny, dependency-free utility to convert string cases like camelCase, snake_case, kebab-case, PascalCase, Title Case, UPPER_CASE, and more.
npm install case-text-utilsbash
npm i case-text-utils
`
⨠Why use
case-text-utils?
ā
Lightweight (under 2KB)
ā
Zero dependencies
ā
Written in clean ES modules
ā
Works in both Node.js & browser
ā
Developer-friendly API
ā
Supports 12+ popular case formats
ā
One-liner conversions with convertCase()
š Usage
`
import {
toCamel,
toSnake,
toKebab,
toPascal,
toUpper,
toLower,
toTitle,
toCapital,
toConstant,
toDot,
toPath,
convertCase
} from 'case-text-utils';
toCamel('hello_world-text'); // "helloWorldText"
toSnake('helloWorldText'); // "hello_world_text"
toKebab('helloWorldText'); // "hello-world-text"
toPascal('hello_world-text'); // "HelloWorldText"
toUpper('hello world'); // "HELLO WORLD"
toLower('HELLO WORLD'); // "hello world"
toTitle('hello-world_case'); // "Hello World Case"
toCapital('hello world'); // "Hello world"
toConstant('helloWorld'); // "HELLO_WORLD"
toPath('helloWorldCase'); // "hello/world/case"
// š One-liner universal converter
convertCase('hello-world_case', 'pascal'); // "HelloWorldCase"
`
ā
Output Preview
`
console.log(toCamel('hello_world-case'));
// ā "helloWorldCase"
console.log(convertCase('my-key_name', 'constant'));
// ā "MY_KEY_NAME"
``