Skip to content

camelCase

Import from @varavel/vdl-plugin-sdk/utils/strings.

function camelCase(str): string;

Converts a string to camelCase.

Tokenization is delegated to words, so mixed input styles such as snake_case, kebab-case, PascalCase, camelCase, and separator-heavy strings are normalized first and then reassembled.

The first token is lowercased. Every following token is capitalized with the remainder lowercased. Empty or separator-only inputs return an empty string.

Parameters

Parameter Type Description
str string String to normalize.

Returns

string

The camelCase representation of str.

Example

camelCase("user_profile-name")
// "userProfileName"