UNPKG

@scalar/api-client

Version:

the open source API testing client

22 lines (21 loc) 386 B
import { isObject as n } from "@scalar/helpers/object/is-object"; import { parse as s } from "yaml"; const a = (r) => { try { return JSON.parse(r); } catch { return null; } }, o = (r) => { try { return s(r); } catch { return null; } }, l = (r, e) => { const t = e === "yaml" ? o(r) : a(r); return n(t) ? t : null; }; export { l as parseEditorObject };