UNPKG

@scalar/api-client

Version:

the open source API testing client

24 lines (23 loc) 726 B
import { getResolvedRef as s } from "@scalar/workspace-store/helpers/get-resolved-ref"; const a = (e, t) => "content" in t ? i(e, Object.keys(t.content ?? {})[0] ?? "") : "schema" in t ? c(e, t.schema) : e, i = (e, t) => { if (typeof e == "string" && t.includes("json")) try { return JSON.parse(e); } catch { } return e; }, o = /* @__PURE__ */ new Set(["array", "object", "boolean", "number", "integer", "null"]), c = (e, t) => { const r = s(t); if (typeof e == "string" && r && "type" in r) { const n = Array.isArray(r.type) ? r.type[0] : r.type; if (n && o.has(n)) try { return JSON.parse(e); } catch { } } return e; }; export { a as deSerializeParameter };