• Converts a string to camelCase.

    Remarks

    This function converts a string to camelCase, which is a naming convention where multiple words are joined together and the first letter of each subsequent word is capitalized, except for the first word.

    Example

    Converting a string with spaces to camelCase:

    toCamelCase('hello world')
    // => { ok: true, value: 'helloWorld' }

    Example

    Converting a string with hyphens to camelCase:

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

    Example

    Handling non-string input:

    toCamelCase(42)
    // => { ok: false, error: Error('[strings.toCamelCase] 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