Skip to content

@pmun/utils / camelToKebab

Function: camelToKebab() ​

ts
function camelToKebab(str): string;

将驼峰命名转换为短横线命名(kebab-case)

Parameters ​

str ​

string

驼峰命名的字符串

Returns ​

string

短横线命名的字符串

Example ​

ts
camelToKebab('helloWorld') // 'hello-world'
camelToKebab('HelloWorld') // 'hello-world'
camelToKebab('APIVersion') // 'api-version'
camelToKebab('iOS9App') // 'i-os9-app'