typedash
Version:
modern, type-safe collection of utility functions
24 lines (22 loc) • 583 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
Object.defineProperty(exports, 'capitalize', {
enumerable: true,
get: function () {
return capitalize;
}
});
//# sourceMappingURL=capitalize-BDqzNm3J.cjs.map