Skip to content

Instantly share code, notes, and snippets.

@jonathanconway
Created March 17, 2026 03:26
Show Gist options
  • Select an option

  • Save jonathanconway/38dae43fbab51aa066bff3c78a8264f9 to your computer and use it in GitHub Desktop.

Select an option

Save jonathanconway/38dae43fbab51aa066bff3c78a8264f9 to your computer and use it in GitHub Desktop.
Converts provided string to PascalCase
import { kebabCase, startCase } from "lodash";
/**
* Converts provided string to PascalCase
* @example my-string => MyString
* @example myString => MyString
* @example my_string => MyString
* @example MY_STRING => MyString
*/
export function pascalCase(input: string) {
return kebabCase(input).split("-").map(startCase).filter(Boolean).join("");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment