Skip to content

kebabCase

Converts a string to kebab-case. Handles camelCase, PascalCase, snake_case, spaces, and mixed formats.

Available since v1.9.0

import { kebabCase } from '@helpers4/string';
// or, from the all-in-one package (same code, one install):
import { kebabCase } from 'helpers4/string';
kebabCase(str: string): string
ParameterTypeDescription
strstringThe string to convert

string — String in kebab-case

Converts a camelCase string to kebab-case.

kebabCase('myComponentName')
// => 'my-component-name'

View source on GitHub