Skip to content

camel2Dash

Converts camelCase strings to dash-case (kebab-case).

Usage

js
import { camel2Dash } from 'js-cool'

Signature

typescript
function camel2Dash(string: string): string

Parameters

ParameterTypeDescription
stringstringThe camelCase string to convert

Returns

string - The converted dash-case string.

Examples

js
camel2Dash('fontSize')
// 'font-size'

camel2Dash('backgroundColor')
// 'background-color'

camel2Dash('marginTop')
// 'margin-top'

camel2Dash('borderTopLeftRadius')
// 'border-top-left-radius'

Released under the MIT License.