{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TGetStrWithCapitalizedArgs = Parameters<typeof getStrWithCapitalized>;\r\n\r\nexport type TGetStrWithCapitalizedReturn = ReturnType<typeof getStrWithCapitalized>;\r\n\r\n/**\r\n * Gets a string with uppercase first letter\r\n * @param str{string} source string\r\n * @returns {string} String with first character uppercased\r\n * @throws {TypeError} If str is not a string\r\n * @example\n * getStrWithCapitalized(\"hello world\"); // \"Hello world\"\n * @example\n * // Capitalize a category name for a page heading\n * const heading = getStrWithCapitalized(category.name);\n */\nexport const getStrWithCapitalized = (str: string): string => {\r\n  if (typeof str !== \"string\") {\r\n    throw new TypeError(\"getStrWithCapitalized: str must be a string\");\r\n  }\r\n  if (!str.length) {\r\n    return \"\";\r\n  }\r\n  const trimmed = str.trim();\r\n  if (!trimmed) {\r\n    return \"\";\r\n  }\r\n  return trimmed[0].toUpperCase() + trimmed.slice(1);\r\n};\r\n"],"names":["getStrWithCapitalized","str","TypeError","length","trimmed","trim","toUpperCase","slice"],"mappings":"AAeO,MAAMA,sBAAyBC,MACpC,UAAWA,MAAQ,SACjB,MAAM,IAAIC,UAAU,+CAEtB,IAAKD,IAAIE,OACP,MAAO,GAET,MAAMC,QAAUH,IAAII,OACpB,IAAKD,QACH,MAAO,GAET,OAAOA,QAAQ,GAAGE,cAAgBF,QAAQG,MAAM"}