case
PoolModern, comprehensive case conversion library - zero dependencies, TypeScript-first, tree-shakeable. Convert between camelCase, snake_case, kebab-case, and 7 more cases. 100% backward compatible with camelcase package.
dist
Functions
function split(input: string): string[]
Split string into words Handles all common case formats: - camelCase → ['camel', 'Case'] - PascalCase → ['Pascal', 'Case'] - snake_case → ['snake', 'case'] - kebab-case → ['kebab', 'case'] - CONSTANT_CASE → ['CONSTANT', 'CASE'] - foo2Bar → ['foo', '2', 'Bar']
| Parameter | Type | Description |
|---|---|---|
input | string | - String to split |
function transform(words: string[], options: TransformOptions): string
Transform words according to options
| Parameter | Type | Description |
|---|---|---|
words | string[] | - Array of words |
options | TransformOptions | - Transformation options |
function camelCase(input: CaseInput, options?: CaseOptions): string
Convert to camelCase 100% backward compatible with the camelcase package by Sindre Sorhus.
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
optionsoptional | CaseOptions | - Conversion options |
function pascalCase(input: CaseInput, options?: Omit<CaseOptions, 'pascalCase'>): string
Convert to PascalCase Alias for camelCase with pascalCase option set to true.
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
optionsoptional | Omit<CaseOptions, 'pascalCase'> | - Conversion options (pascalCase option is ignored) |
function snakeCase(input: CaseInput): string
Convert to snake_case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function kebabCase(input: CaseInput): string
Convert to kebab-case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function constantCase(input: CaseInput): string
Convert to CONSTANT_CASE
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function dotCase(input: CaseInput): string
Convert to dot.case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function pathCase(input: CaseInput): string
Convert to path/case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function sentenceCase(input: CaseInput): string
Convert to Sentence case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function titleCase(input: CaseInput): string
Convert to Title Case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function trainCase(input: CaseInput): string
Convert to Train-Case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
dist
Functions
function split(input: string): string[]
Split string into words Handles all common case formats: - camelCase → ['camel', 'Case'] - PascalCase → ['Pascal', 'Case'] - snake_case → ['snake', 'case'] - kebab-case → ['kebab', 'case'] - CONSTANT_CASE → ['CONSTANT', 'CASE'] - foo2Bar → ['foo', '2', 'Bar']
| Parameter | Type | Description |
|---|---|---|
input | string | - String to split |
function transform(words: string[], options: TransformOptions): string
Transform words according to options
| Parameter | Type | Description |
|---|---|---|
words | string[] | - Array of words |
options | TransformOptions | - Transformation options |
function camelCase(input: CaseInput, options?: CaseOptions): string
Convert to camelCase 100% backward compatible with the camelcase package by Sindre Sorhus.
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
optionsoptional | CaseOptions | - Conversion options |
function pascalCase(input: CaseInput, options?: Omit<CaseOptions, 'pascalCase'>): string
Convert to PascalCase Alias for camelCase with pascalCase option set to true.
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
optionsoptional | Omit<CaseOptions, 'pascalCase'> | - Conversion options (pascalCase option is ignored) |
function snakeCase(input: CaseInput): string
Convert to snake_case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function kebabCase(input: CaseInput): string
Convert to kebab-case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function constantCase(input: CaseInput): string
Convert to CONSTANT_CASE
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function dotCase(input: CaseInput): string
Convert to dot.case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function pathCase(input: CaseInput): string
Convert to path/case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function sentenceCase(input: CaseInput): string
Convert to Sentence case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function titleCase(input: CaseInput): string
Convert to Title Case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
function trainCase(input: CaseInput): string
Convert to Train-Case
| Parameter | Type | Description |
|---|---|---|
input | CaseInput | - String or array to convert |
Taxes calculated at checkout based on your location.