Skip to content

pascalCase ​

Convert any common string casing — kebab, snake, space-separated, camelCase or UPPERCASE — to PascalCase.

Usage ​

ts
import { pascalCase } from '@maz-ui/utils'

pascalCase('my-component-name') // → 'MyComponentName'
pascalCase('hello_world') // → 'HelloWorld'
pascalCase('hello world') // → 'HelloWorld'
pascalCase('helloWorld') // → 'HelloWorld'

API ​

ts
function pascalCase(str: string): string
ParameterTypeDescription
strstringThe string to convert

Notes ​

  • Detects -, _ and space separators automatically.
  • Handles ALL-CAPS inputs by lowercasing before re-capitalizing.
  • For fine-grained control, use normalizeString with { case: 'PascalCase' }.