Skip to content

@technobuddha > library > Programming > Variables

Function: kebabCase() ​

ts
function kebabCase(input: string): string;

Defined in: kebab-case.ts:18

Convert an identifier string to a kebab-case form

Parameters ​

ParameterTypeDescription
inputstringThe identifier string

Returns ​

string

the identifier in kebab-case form

Example ​

typescript
kebabCase('hello world'); // 'hello-world'
kebabCase('HelloWorld'); // 'hello-world'
kebabCase('foo_bar-baz'); // 'foo-bar-baz'
kebabCase('FOO BAR'); // 'foo-bar'