{"version":3,"file":"index.mjs","sources":[""],"sourcesContent":["export type TIsJSONArgs = Parameters<typeof isJSON>;\r\n\r\nexport type TIsJSONReturn = ReturnType<typeof isJSON>;\r\n\r\n/**\r\n * Checks if a string is a valid JSON string\r\n * @param {string} str source String\r\n * @returns {boolean}\r\n * @example\r\n * // How to check if string is a JSON?\r\n * const str = '{ \"hello\": \"world\" }';\r\n * const isStrJSON = isJSON(str);\r\n * console.log(isStrJSON); // => true\r\n */\r\nexport const isJSON = (str: unknown): boolean => {\r\n  if (typeof str === \"string\" && str.length) {\r\n    try {\r\n      const json = JSON.parse(str);\r\n      return typeof json === \"object\" && json !== null;\r\n      // eslint-disable-next-line no-unused-vars\r\n    } catch (_err) {\r\n      return false;\r\n    }\r\n  }\r\n  return false;\r\n};\r\n"],"names":["isJSON","str","length","json","JSON","parse","_err"],"mappings":";;;;;;;;;;AAcO,MAAMA,OAAUC,MACrB,UAAWA,MAAQ,UAAYA,IAAIC,OACjC,IACE,MAAMC,KAAOC,KAAKC,MAAMJ,KACxB,cAAcE,OAAS,UAAYA,OAAS;0CAE9C;CAAE,MAAOG,MACP,OAAO,KACT,CAEF,OAAO"}