• Converts a camelCase string to snake_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 snake_case:

    camelToSnake('helloWorld')
    // => { ok: true, value: 'hello_world' }

    Example

    Handle an invalid input string:

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

    Parameters

    • str: string

      The camelCase string to convert.

    Returns Result<string, Error>

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

Generated using TypeDoc v0.24.7