{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TGetStrWithNormalizedSpacesArgs = Parameters<typeof getStrWithNormalizedSpaces>;\n\nexport type TGetStrWithNormalizedSpacesReturn = ReturnType<typeof getStrWithNormalizedSpaces>;\n\n/**\n * Trims a string and replaces consecutive whitespace with a single space.\n * @param {string} str Source string\n * @returns {string} Normalized string\n * @throws {TypeError} getStrWithNormalizedSpaces: str must be a string\n * @example\n * getStrWithNormalizedSpaces(\"  hello\\n world  \"); // \"hello world\"\n * @example\n * // Normalize a search query pasted by a user\n * const query = getStrWithNormalizedSpaces(searchInput.value);\n */\nexport const getStrWithNormalizedSpaces = (str: string): string => {\n  if (typeof str !== \"string\") {\n    throw new TypeError(\"getStrWithNormalizedSpaces: str must be a string\");\n  }\n  return str.trim().replace(/\\s+/gu, \" \");\n};\n"],"names":["getStrWithNormalizedSpaces","str","TypeError","trim","replace"],"mappings":"AAeO,MAAMA,2BAA8BC,MACzC,UAAWA,MAAQ,SACjB,MAAM,IAAIC,UAAU,oDAEtB,OAAOD,IAAIE,OAAOC,QAAQ,QAAS"}