( input: T, )
| 20 | * @returns The kebab-case string. |
| 21 | */ |
| 22 | export function camelCaseToKebabCase<T extends string>( |
| 23 | input: T, |
| 24 | ): CamelCaseToKebabCase<T> { |
| 25 | return input |
| 26 | .replace(/([a-z])([A-Z])/g, '$1-$2') // Insert dash before uppercase letters |
| 27 | .replace(/([A-Z])([A-Z][a-z])/g, '$1-$2') // Handle consecutive uppercase letters |
| 28 | .toLowerCase() as CamelCaseToKebabCase<T>; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Converts a string to Title Case. |
no outgoing calls
no test coverage detected