@scalar/api-client
Version:
the open source API testing client
32 lines (31 loc) • 842 B
JavaScript
import { getRaw as d } from "@scalar/json-magic/magic-proxy";
const v = (i) => {
const o = /* @__PURE__ */ new WeakSet(), f = (e) => {
if (e == null || typeof e != "object")
return e;
const t = d(e);
if (o.has(t))
return "[circular]";
if (o.add(t), typeof e == "object" && e !== null && "$ref" in e) {
const l = e["$ref-value"], s = f(l);
return o.delete(t), s;
}
if (Array.isArray(e)) {
const l = e.map((s) => f(s));
return o.delete(t), l;
}
if (e instanceof File || e instanceof Date)
return o.delete(t), e;
if (typeof e == "object" && e !== null) {
const l = {};
for (const [s, a] of Object.entries(e))
l[s] = f(a);
return o.delete(t), l;
}
return o.delete(t), e;
};
return f(i);
};
export {
v as getResolvedRefDeep
};