DEV Community

Manu Kumar Pal
Manu Kumar Pal

Posted on

πŸš€ Convert Any String Case in 1 Line! Meet case-text-utils 🧰

Hey devs! πŸ‘‹ I just released a tiny, powerful package called case-text-utils β€” a utility that helps you convert between string cases effortlessly.

πŸ”§ Step 1: Install it

npm install case-text-utils
Enter fullscreen mode Exit fullscreen mode

🧠 Step 2: Import what you need

import {
  toCamel,
  toSnake,
  toKebab,
  toPascal,
  convertCase
} from 'case-text-utils';
Enter fullscreen mode Exit fullscreen mode

⚑ Step 3: Use it (Examples)

toCamel('hello_world-text');      // β†’ "helloWorldText"
toSnake('helloWorldText');        // β†’ "hello_world_text"
toPascal('hello_world-text');     // β†’ "HelloWorldText"

_Or use the universal converter_:

convertCase('user_name-key', 'pascal');
// β†’ "UserNameKey"
Enter fullscreen mode Exit fullscreen mode

βœ… Why use case-text-utils?

πŸͺΆ Just 2KB
πŸ“¦ Zero dependencies
🧼 Clean ESM
🌐 Works in both Node.js & browser
πŸ” One-liner conversions

πŸ“¦ NPM Link:- https://www.npmjs.com/package/case-text-utils

⭐ If you find it useful, give it a try and star the repo!Feel free to share feedback or suggestions. πŸ™Œ

Top comments (0)