@bangbu/ts-utils
Version:
Utility functions and constants for Cyberk
13 lines • 417 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.capitalize = capitalize;
// capitalize first character of each word in a string
function capitalize(str) {
if (!str || typeof str !== "string")
return str;
return str
.split(" ")
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
.join(" ");
}
//# sourceMappingURL=capitalize.js.map