Function capitalize

  • Converts the first character of string to upper case and the remaining to lower case.

    Type Parameters

    • T extends string

      Literal type of the string.

    Parameters

    • str: T

      The string to be converted to uppercase.

    Returns Capitalize<T>

    • The capitalized string.
    const result = capitalize('fred') // returns 'Fred'
    const result2 = capitalize('FRED') // returns 'Fred'