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
};
