@azizbecha/strkit
Version:
strkit is a utility library offering a collection of essential string functions including validation, case conversion, truncation, and more. Ideal for both JavaScript and TypeScript developers to simplify string operations in their applications.
27 lines • 866 B
JavaScript
/**
* Capitalizes the first letter of the input string.
* @param str - The string to capitalize.
* @returns The string with the first letter capitalized.
*
* @example
* capitalize('hello'); // 'Hello'
*/
(function (factory) {
if (typeof module === "object" && typeof module.exports === "object") {
var v = factory(require, exports);
if (v !== undefined) module.exports = v;
}
else if (typeof define === "function" && define.amd) {
define(["require", "exports"], factory);
}
})(function (require, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = capitalize;
function capitalize(str) {
if (!str)
return '';
return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase();
}
});
//# sourceMappingURL=capitalize.js.map