all repos — kitten @ b219fb2f774165981101cc0bf3ba30e9fd84fa65

pkgs/types/src/lib/utils.ts (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
export function toCamelCase(str: string): string {
	return str
		.split(/[-_]/)
		.map((word, index) => (index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)))
		.join("");
}

export function toPascalCase(str: string): string {
	return str
		.split(/[-_]/)
		.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
		.join("");
}