mirror of
https://github.com/zoriya/v10.git
synced 2026-08-07 14:48:09 +00:00
12 lines
391 B
TypeScript
12 lines
391 B
TypeScript
export function pascalCase(str: string): string {
|
|
return str.replace(/[-_](.)/g, (_, c) => c.toUpperCase()).replace(/^(.)/, (_, c) => c.toUpperCase());
|
|
}
|
|
|
|
export function camelCase(str: string): string {
|
|
return pascalCase(str).replace(/^(.)/, (_, c) => c.toLowerCase());
|
|
}
|
|
|
|
export function kebabCase(str: string): string {
|
|
return str.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
}
|