Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 | 8x 3x 2x | /**
* Capitalizes the first letter of a string.
*
* @param str - The string to capitalize.
* @returns The capitalized string.
*
* @example
* capitalize('hello'); // 'Hello'
*/
export function capitalize(str: string): string {
if (!str) return '';
return str[0].toUpperCase() + str.slice(1);
} |