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) 577 B
/** * 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)};export{getStrWithCapitalized}; //# sourceMappingURL=index.mjs.map