typedash
Version:
modern, type-safe collection of utility functions
18 lines (17 loc) • 490 B
JavaScript
//#region src/functions/capitalize/capitalize.ts
/**
* Returns a new string with the first character capitalized.
* @param string The input string to capitalize.
* @returns A new string with the first character capitalized.
* @example
* ```ts
* capitalize('foo'); // 'Foo'
* capitalize(''); // ''
* ```
*/
function capitalize(string) {
return `${string.charAt(0).toUpperCase()}${string.slice(1)}`;
}
//#endregion
export { capitalize as t };
//# sourceMappingURL=capitalize-C9a76pfn.js.map