@redpanda-data/docs-extensions-and-macros
Version:
Antora extensions and macros developed for Redpanda documentation.
14 lines (12 loc) • 352 B
JavaScript
;
/**
* Capitalizes the first letter of a string
* @param {string} str - The string to capitalize
* @returns {string} The string with first letter capitalized
*/
module.exports = function capitalize(str) {
if (typeof str !== 'string' || str.length === 0) {
return str;
}
return str.charAt(0).toUpperCase() + str.slice(1);
};