Variable: hyphenate()
const
hyphenate: (str
) =>string
Converts a camelCase string to kebab-case. Results are cached for performance.
Parameters
str
string
The camelCase string to convert
Returns
string
The kebab-case version of the string
Example
typescript
console.log(hyphenate('helloWorld')) // 'hello-world'
console.log(hyphenate('myComponentName')) // 'my-component-name'
console.log(hyphenate('single')) // 'single'
console.log(hyphenate('XMLHttpRequest')) // 'x-m-l-http-request'