• Capitalizes the first letter of a given string and converts the rest of the string to lowercase.

    Example

    capitalize("hello world")
    // => { ok: true, value: 'Hello World' }

    Example

    Handling non-string input:

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

    Parameters

    • str: string

      The string to capitalize.

    Returns Result<string, Error>

    A Result object with either the capitalized string on success, or an Error object if the provided input is not a string.

Generated using TypeDoc v0.24.7