UNPKG

@web3r/flowerkit

Version:

Tree-shakable JavaScript and TypeScript utility library for frontend/browser apps: DOM, events, arrays, objects, strings, date, JSON, and network helpers (ESM/CJS, SSR-friendly).

11 lines (10 loc) 656 B
Object.defineProperty(exports,"__esModule",{value:true}); /** * Gets a string with uppercase first letter * @param str{string} source string * @returns {string} String with first character uppercased * @throws {TypeError} If str is not a string * @example * getStrWithCapitalized("hello world"); // "Hello world" */const getStrWithCapitalized=str=>{if(typeof str!=="string")throw new TypeError("getStrWithCapitalized: str must be a string");if(!str.length)return"";const trimmed=str.trim();if(!trimmed)return"";return trimmed[0].toUpperCase()+trimmed.slice(1)};exports.getStrWithCapitalized=getStrWithCapitalized; //# sourceMappingURL=index.cjs.map