MCPcopy Index your code
hub / github.com/dataease/SQLBot / destroyCircular

Function destroyCircular

frontend/public/swagger-ui-bundle.js:7950–7991  ·  view source on GitHub ↗
({
              from: s,
              seen: o,
              to_: i,
              forceEnumerable: w,
              maxDepth: x,
              depth: C,
            })

Source from the content-addressed store, hash-verified

7948 ],
7949 _ = Symbol('.toJSON called'),
7950 destroyCircular = ({
7951 from: s,
7952 seen: o,
7953 to_: i,
7954 forceEnumerable: w,
7955 maxDepth: x,
7956 depth: C,
7957 }) => {
7958 const j = i || (Array.isArray(s) ? [] : {})
7959 if ((o.push(s), C >= x)) return j
7960 if ('function' == typeof s.toJSON && !0 !== s[_])
7961 return ((s) => {
7962 s[_] = !0
7963 const o = s.toJSON()
7964 return (delete s[_], o)
7965 })(s)
7966 for (const [i, u] of Object.entries(s))
7967 'function' == typeof a && a.isBuffer(u)
7968 ? (j[i] = '[object Buffer]')
7969 : 'function' != typeof u &&
7970 (u && 'object' == typeof u
7971 ? o.includes(s[i])
7972 ? (j[i] = '[Circular]')
7973 : (C++,
7974 (j[i] = destroyCircular({
7975 from: s[i],
7976 seen: o.slice(),
7977 forceEnumerable: w,
7978 maxDepth: x,
7979 depth: C,
7980 })))
7981 : (j[i] = u))
7982 for (const { property: o, enumerable: i } of u)
7983 'string' == typeof s[o] &&
7984 Object.defineProperty(j, o, {
7985 value: s[o],
7986 enumerable: !!w || i,
7987 configurable: !0,
7988 writable: !0,
7989 })
7990 return j
7991 }
7992 s.exports = {
7993 serializeError: (s, o = {}) => {
7994 const { maxDepth: i = Number.POSITIVE_INFINITY } = o

Callers 1

Calls 4

toJSONMethod · 0.80
isArrayMethod · 0.45
pushMethod · 0.45
includesMethod · 0.45

Tested by

no test coverage detected