LendAndRegret/node_modules/es-toolkit/dist/compat/string/capitalize.d.ts
2026-05-02 17:27:43 +08:00

15 lines
528 B
TypeScript

/**
* Converts the first character of string to upper case and the remaining to lower case.
*
* @param {string} string - The string to capitalize.
* @returns {string} - The capitalized string.
*
* @example
* const convertedStr1 = capitalize('fred') // returns 'Fred'
* const convertedStr2 = capitalize('FRED') // returns 'Fred'
* const convertedStr3 = capitalize('') // returns ''
*/
declare function capitalize<T extends string>(str?: T): string extends T ? string : Capitalize<Lowercase<T>>;
export { capitalize };