Skip to content

transformCase

transformCase(params): string

Defined in: strings/transform-case/index.ts:122

Converts a string between case styles.

TransformCaseParams

The parameters object

string

The converted string

transformCase({ str: "hello world", to: "camel" });
// => "helloWorld"
transformCase({ str: "HTMLParser", to: "title", preserveAcronyms: true });
// => "HTML Parser"

camelCase, snake_case, kebab-case, PascalCase, title case, Title Case, convert case, acronym

Error if str is not a string

Error if to is not a valid case style