Skip to content

@longmo-utils/common / kebabCase

Function: kebabCase()

ts
function kebabCase(str): string;

将字符串转换为短横线命名

Parameters

ParameterTypeDescription
strstring输入字符串

Returns

string

短横线命名字符串

Example

ts
kebabCase('helloWorld') // 'hello-world'
kebabCase('hello_world') // 'hello-world'
kebabCase('hello world') // 'hello-world'

Released under the MIT License.