A lightweight utility for converting strings between common naming conventions like camelCase, PascalCase, snake_case, kebab-case, and dot.case.
npm install casecraftcasecraft is a lightweight utility that converts strings between common naming
conventions like camelCase, PascalCase, snake_case, kebab-case, and more.
It helps developers maintain consistent naming across codebases, APIs, databases,
and user-facing content.
> Good naming is fundamental to clean code. casecraft ensures your naming follows
> the right conventions for the right contexts ā automatically.
---
``bash`
npm install casecraft
---
Import and use casecraft to convert strings:
`js
import {
toCamelCase,
toSnakeCase,
toKebabCase
} from 'casecraft';
toCamelCase('user_profile_data');
// ā userProfileData
toSnakeCase('userProfileData');
// ā user_profile_data
toKebabCase('GetUserInfo');
// ā get-user-info
`
---
- camelCase
From: user_profile_data userProfileData
To:
Usage: JS variables, functions, internals
- PascalCase
From: get-user-info GetUserInfo
To:
Usage: Class names, components, constructors
- snake_case
From: userNameIsJohnDoe user_name_is_john_doe
To:
Usage: Databases, file names, Python/Ruby
- kebab-case
From: getUserProfileData get-user-profile-data
To:
Usage: URLs, CSS class names
- dot.case
From: getUserDataFromDatabase get.user.data.from.database
To:
Usage: Config keys, settings
- SCREAMING_SNAKE_CASE
From: sessionTimeoutWarning SESSION_TIMEOUT_WARNING
To:
Usage: Constants, env variables
- lowercase
From: HELLO_WORLD hello_world
To:
Usage: File systems, normalization
- UPPERCASE
From: helloWorld123 HELLOWORLD123
To:
Usage: Constants, emphasis
- Title Case
From: this is a title case string This Is A Title Case String
To:
Usage: Headings, labels
- Train-Case
From: user-login-data User-Login-Data
To:
Usage: URLs, titles
- path/case
From: user.profile.image user/profile/image
To:
Usage: File paths, folders
- slug-case
From: A Great Day in the City! a-great-day-in-the-city
To:
Usage: Slugs, SEO URLs
- noSpaces
From: No Spaces Allowed! noSpacesAllowed
To:
Usage: Compact identifiers
- human-readable
From: this_is_a_cool_example This is a cool example
To:
Usage: UI labels, plain text
---
Consistent naming:
- Improves readability
- Reduces team friction
- Follows language best practices
- Enhances cross-system integration
- Simplifies debugging and maintenance
casecraft lets you focus on clean code, not tedious string formatting.
---
See the full API and tools in the GitHub repo.
---
- GitHub: fabforms/casecraft
- NPM: casecraft on NPM
---
We welcome issues, pull requests, and feedback.
Join us on GitHub!
---
1. Fork the repo
2. Create a new branch
3. Make your changes
4. Open a pull request
Please follow conventional commits and include docs/tests where helpful.
---
FabForm.io helps you build, manage, and process forms with ease.
- Built for JAMstack, static sites, and modern apps
- Handles submissions, spam filtering, and notifications
- Just connect your form and go ā no backend needed
š Try it at FabForm.io
```