{"version":3,"file":"index.cjs","sources":[""],"sourcesContent":["export type TGetStrEscapedArgs = Parameters<typeof getStrEscaped>;\r\n\r\nexport type TGetStrEscapedReturn = ReturnType<typeof getStrEscaped>;\r\n\r\n/**\r\n * Escapes special HTML characters to their corresponding entities.\r\n * Escaped: `& < > \" '` \r\n * @param {string} str Source string\r\n * @returns {string} Escaped string safe for HTML text context\r\n * @throws {TypeError} If str is not a string\r\n * @example\r\n * getStrEscaped('<b>Hello & \"world\"</b>');\r\n * // => \"&lt;b&gt;Hello &amp; &quot;world&quot;&lt;/b&gt;\"\r\n */\r\nexport const getStrEscaped = (str: string): string => {\r\n\r\n  if (typeof str !== \"string\") {\r\n    throw new TypeError(\"getStrEscaped: str must be a string\");\r\n  }\r\n\r\n  const symbols: Record<string, string> = {\r\n    \"&\": \"&amp;\",\r\n    \"<\": \"&lt;\",\r\n    \">\": \"&gt;\",\r\n    \"\\\"\": \"&quot;\",\r\n    \"'\": \"&#39;\",\r\n  };\r\n\r\n  const regExp = /[&<>\"']/g;\r\n\r\n  const getEscaped = (char: \"&\" | \"<\" | \">\" | \"\\\"\" | \"'\"): string => symbols[char];\r\n\r\n  return str.replace(regExp, getEscaped as (m: string) => string);\r\n};\r\n"],"names":["getStrEscaped","str","TypeError","symbols","regExp","getEscaped","char","replace"],"mappings":";;;;;;;;;;GAcO,MAAMA,cAAiBC,MAE5B,UAAWA,MAAQ,SACjB,MAAM,IAAIC,UAAU,uCAGtB,MAAMC,QAAkC,CACtC,IAAK,QACL,IAAK,OACL,IAAK,OACL,IAAM,SACN,IAAK,SAGP,MAAMC,OAAS,WAEf,MAAMC,WAAcC,MAA+CH,QAAQG,MAE3E,OAAOL,IAAIM,QAAQH,OAAQC"}