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

Function cloneDeep

frontend/public/swagger-ui-bundle.js:42649–42685  ·  view source on GitHub ↗
(s, o = {})

Source from the content-addressed store, hash-verified

42647 (s.endIndex = null == o ? void 0 : o.endIndex),
42648 s
42649 ),
42650 cloneDeep = (s, o = {}) => {
42651 const { visited: i = new WeakMap() } = o,
42652 a = { ...o, visited: i }
42653 if (i.has(s)) return i.get(s)
42654 if (s instanceof Su.KeyValuePair) {
42655 const { key: o, value: u } = s,
42656 _ = Cu(o) ? cloneDeep(o, a) : o,
42657 w = Cu(u) ? cloneDeep(u, a) : u,
42658 x = new Su.KeyValuePair(_, w)
42659 return (i.set(s, x), x)
42660 }
42661 if (s instanceof Su.ot) {
42662 const mapper = (s) => cloneDeep(s, a),
42663 o = [...s].map(mapper),
42664 u = new Su.ot(o)
42665 return (i.set(s, u), u)
42666 }
42667 if (s instanceof Su.G6) {
42668 const mapper = (s) => cloneDeep(s, a),
42669 o = [...s].map(mapper),
42670 u = new Su.G6(o)
42671 return (i.set(s, u), u)
42672 }
42673 if (Cu(s)) {
42674 const o = cloneShallow(s)
42675 if ((i.set(s, o), s.content))
42676 if (Cu(s.content)) o.content = cloneDeep(s.content, a)
42677 else if (s.content instanceof Su.KeyValuePair) o.content = cloneDeep(s.content, a)
42678 else if (Array.isArray(s.content)) {
42679 const mapper = (s) => cloneDeep(s, a)
42680 o.content = s.content.map(mapper)
42681 } else o.content = s.content
42682 else o.content = s.content
42683 return o
42684 }
42685 throw new Vu("Value provided to cloneDeep function couldn't be cloned", { value: s })
42686 }
42687 cloneDeep.safe = (s) => {
42688 try {

Callers 15

mapperFunction · 0.85
cloneShallowElementFunction · 0.85
refractFunction · 0.85
emptyElementFunction · 0.85
deepmergeFunction · 0.85
enterMethod · 0.85
toRefractedElementMethod · 0.85
ObjectElementMethod · 0.85
ObjectElementMethod · 0.85
enterMethod · 0.85

Calls 7

cloneShallowFunction · 0.85
getMethod · 0.65
CuFunction · 0.50
hasMethod · 0.45
setMethod · 0.45
mapMethod · 0.45
isArrayMethod · 0.45

Tested by

no test coverage detected