Skip to content

pascalCase

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

Available since v2.0.0

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

string — String in PascalCase

Converts a kebab-case string to PascalCase.

pascalCase('my-component')
// => 'MyComponent'

Also handles snake_case and other formats.

pascalCase('user_first_name')
// => 'UserFirstName'

View source on GitHub