Skip to content

Variable: camelize()

const camelize: (str) => string

Converts a kebab-case string to camelCase. Results are cached for performance.

Parameters

str

string

The kebab-case string to convert

Returns

string

The camelCase version of the string

Example

typescript
console.log(camelize('hello-world'))      // 'helloWorld'
console.log(camelize('my-component-name')) // 'myComponentName'
console.log(camelize('single'))           // 'single'
console.log(camelize(''))                 // ''

Released under the MIT License.