Package Exports
- devkits-text-case
- devkits-text-case/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (devkits-text-case) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
devkits-text-case
Convert text between camelCase, snake_case, kebab-case, PascalCase, and more. Zero dependencies.
Install
npm install -g devkits-text-caseUsage
CLI
# Convert to camelCase
textcase "hello world" -t camel
# Output: helloWorld
# Convert to snake_case
textcase "HelloWorld" -t snake
# Output: hello_world
# Convert to kebab-case
textcase "my_variable_name" -t kebab
# Output: my-variable-name
# Convert to PascalCase
textcase "my-variable" -t pascal
# Output: MyVariable
# List all formats
textcase -lProgrammatic API
const { toWords, CASES } = require('devkits-text-case');
// Parse text into words
const words = toWords('helloWorld'); // ['hello', 'world']
const words2 = toWords('my_variable'); // ['my', 'variable']
// Convert using built-in converters
CASES.camel(['hello', 'world']); // 'helloWorld'
CASES.snake(['hello', 'world']); // 'hello_world'
CASES.kebab(['hello', 'world']); // 'hello-world'
CASES.pascal(['hello', 'world']); // 'HelloWorld'
CASES.constant(['hello', 'world']); // 'HELLO_WORLD'Supported Formats
| Format | Alias | Example |
|---|---|---|
camelCase |
camel |
myVariableName |
PascalCase |
pascal |
MyVariableName |
snake_case |
snake |
my_variable_name |
CONSTANT_CASE |
constant |
MY_VARIABLE_NAME |
kebab-case |
kebab |
my-variable-name |
UPPER CASE |
upper |
MY VARIABLE NAME |
lower case |
lower |
my variable name |
Title Case |
title |
My Variable Name |
Sentence case |
sentence |
My variable name |
dot.case |
dot |
my.variable.name |
Use Cases
- Programming — Convert between naming conventions (JavaScript camelCase ↔ Python snake_case)
- Database — Convert column names between conventions
- API development — Standardize field naming across services
- Refactoring — Batch rename variables in code
- CSS — Convert between camelCase and kebab-case properties
Examples
# JavaScript to Python
$ textcase "userName" -t snake
user_name
# Python to JavaScript
$ textcase "user_name" -t camel
userName
# CSS property conversion
$ textcase "background-color" -t camel
backgroundColor
# Database column naming
$ textcase "FirstName" -t snake
first_name
# Constants
$ textcase "max_retry_count" -t constant
MAX_RETRY_COUNTFeatures
- Smart parsing — Handles camelCase, snake_case, kebab-case, spaces, dots
- 10 formats — All common naming conventions covered
- Zero dependencies — Pure JavaScript, no external packages
- Programmatic API — Use in your own Node.js scripts
- CLI + library — Works as command tool or npm module
Related Tools
🔍 Build something amazing? Check out API Monitor — simple, affordable API monitoring for indie hackers. Get alerted before your customers notice. Just $9/mo.
See Also
- DevKits — All 82 free developer tools in one place
- JSON Formatter — Format and validate JSON
- Base64 Encoder — Encode/decode Base64
- JWT Decoder — Decode JWT tokens
- UUID Generator — Generate UUIDs
- Hash Generator — Create MD5, SHA1, SHA256 hashes
- CSS Tools — CSS minifier, formatter, validator
- HTML Tools — HTML formatter, minifier
- URL Tools — URL encode/decode, parse
- Color Converter — Convert HEX, RGB, HSL colors
- Regex Tester — Test and debug regular expressions
Support DevKits
If you find this tool useful, please consider supporting the project:
Open Collective
Become a sponsor: Open Collective - DevKits
Crypto Donations
Prefer crypto? We accept:
- ETH (Ethereum):
0xDea4a6A20fCB44467e45Ef378972F54B22dC59db - USDC (ERC-20):
0xDea4a6A20fCB44467e45Ef378972F54B22dC59db
Donation Perks:
- $5+ — Supporter Badge
- $10+ — Pro Access (1 month)
- $29+ — Pro Access (1 year)
- $100+ — Lifetime Pro + Priority Support
After donating, email your transaction hash to devkits@aiforeverthing.com to claim perks.
License
MIT — DevKits Team