@scalar/api-client
Version:
the open source API testing client
30 lines (29 loc) • 765 B
JavaScript
import { getRaw as i } from "@scalar/json-magic/magic-proxy";
const n = (a) => {
const o = /* @__PURE__ */ new WeakSet(), f = (e) => {
if (e == null || typeof e != "object")
return e;
const t = i(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 (typeof e == "object" && e !== null) {
const l = {};
for (const [s, d] of Object.entries(e))
l[s] = f(d);
return o.delete(t), l;
}
return o.delete(t), e;
};
return f(a);
};
export {
n as getResolvedRefDeep
};