mirror of
https://github.com/toss/es-toolkit.git
synced 2024-11-28 03:34:26 +03:00
16d326c4b2
* feat(capitalize): add capitalize * fix(capitalize): return type * Update docs/ko/reference/string/capitalize.md --------- Co-authored-by: Sojin Park <raon0211@gmail.com>
485 B
485 B
capitalize
Converts the first character of string to upper case and the remaining to lower case.
Signature
function capitalize<T extends string>(str: T): Capitalize<T>;
Parameters
str
(T
): The string to be converted to uppercase.
Returns
(Capitalize<string>
): The capitalized string.
Examples
import { capitalize } from 'es-toolkit/string';
capitalize('fred'); // returns 'Fred'
capitalize('FRED'); // returns 'Fred'