(name: string)
| 6 | * BuildSimulator -> build-simulator |
| 7 | */ |
| 8 | export function toKebabCase(name: string): string { |
| 9 | return ( |
| 10 | name |
| 11 | .trim() |
| 12 | // Replace underscores with hyphens |
| 13 | .replace(/_/g, '-') |
| 14 | // Insert hyphen before uppercase letters (for camelCase/PascalCase) |
| 15 | .replace(/([a-z])([A-Z])/g, '$1-$2') |
| 16 | // Replace spaces with hyphens |
| 17 | .replace(/\s+/g, '-') |
| 18 | // Convert to lowercase |
| 19 | .toLowerCase() |
| 20 | // Remove any duplicate hyphens |
| 21 | .replace(/-+/g, '-') |
| 22 | // Trim leading/trailing hyphens |
| 23 | .replace(/^-|-$/g, '') |
| 24 | ); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Convert kebab-case CLI flag back to camelCase for tool params. |
no outgoing calls
no test coverage detected