Skip to content

camelCase

Converts a string to camelCase. Handles PascalCase, kebab-case, snake_case, spaces, and mixed formats.

An embedded run of capitals is treated as an acronym boundary: only its last letter starts the next word, the rest are lowercased (matching lodash’s camelCase convention) — so an already-camelCase identifier containing an acronym is not left untouched.

Available since v1.9.0

import { camelCase } from '@helpers4/string';
// or, from the all-in-one package (same code, one install):
import { camelCase } from 'helpers4/string';
camelCase(str: string): string
ParameterTypeDescription
strstringThe string to convert

string — String in camelCase

Converts a kebab-case string to camelCase.

camelCase('my-component-name')
// => 'myComponentName'

View source on GitHub