• Converts a string to kebab-case.

    Remarks

    This function converts a string to kebab-case, which is a naming convention where multiple words are joined together with hyphens, and all letters are lowercase.

    Example

    Converting a string with spaces to camelCase:

    toKebabCase('hello world')
    // => { ok: true, value: 'hello-world' }

    Example

    Converting a string with hyphens to camelCase:

    toKebabCase('fooBarBaz')
    // => { ok: true, value: 'foo-bar-baz' }

    Example

    Handling non-string input:

    toKebabCase(42)
    // => { ok: false, error: Error('[strings.toKebabCase] Expected string value as input') }

    Parameters

    • str: string

      The input string to convert.

    Returns Result<string, Error>

    A Result containing the converted string on success, or an Error object if the provided input is not a string.

Generated using TypeDoc v0.24.7