Converts a camelCase string to kebab-case.
This function expects a string input and returns a Result object containing either the converted string on success or an error on failure.
Convert a camelCase string to kebab-case:
camelToKebab('helloWorld');// => { ok: true, value: 'hello-world' } Copy
camelToKebab('helloWorld');// => { ok: true, value: 'hello-world' }
Handle an invalid input string:
camelToKebab(42)// => { ok: false, error: Error('[strings.camelToKebab] Expected string value as input') } Copy
camelToKebab(42)// => { ok: false, error: Error('[strings.camelToKebab] Expected string value as input') }
The camelCase string to convert.
A Result object containing either the converted string or an or an Error object if the provided input is not a string.
Result
Error
Generated using TypeDoc v0.24.7
Converts a camelCase string to kebab-case.
Remarks
This function expects a string input and returns a Result object containing either the converted string on success or an error on failure.
Example
Convert a camelCase string to kebab-case:
Example
Handle an invalid input string: