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

Method findRecursive

frontend/public/swagger-ui-bundle.js:5086–5122  ·  view source on GitHub ↗
(...s)

Source from the content-addressed store, hash-verified

5084 return (s && (o.path = s), o)
5085 }
5086 findRecursive(...s) {
5087 if (arguments.length > 1 && !this.isFrozen)
5088 throw new Error(
5089 'Cannot find recursive with multiple element names without first freezing the element. Call `element.freeze()`'
5090 )
5091 const o = s.pop()
5092 let i = new _()
5093 const append = (s, o) => (s.push(o), s),
5094 checkElement = (s, i) => {
5095 i.element === o && s.push(i)
5096 const a = i.findRecursive(o)
5097 return (
5098 a && a.reduce(append, s),
5099 i.content instanceof u &&
5100 (i.content.key && checkElement(s, i.content.key),
5101 i.content.value && checkElement(s, i.content.value)),
5102 s
5103 )
5104 }
5105 return (
5106 this.content &&
5107 (this.content.element && checkElement(i, this.content),
5108 Array.isArray(this.content) && this.content.reduce(checkElement, i)),
5109 s.isEmpty ||
5110 (i = i.filter((o) => {
5111 let i = o.parents.map((s) => s.element)
5112 for (const o in s) {
5113 const a = s[o],
5114 u = i.indexOf(a)
5115 if (-1 === u) return !1
5116 i = i.splice(0, u)
5117 }
5118 return !0
5119 })),
5120 i
5121 )
5122 }
5123 set(s) {
5124 return ((this.content = s), this)
5125 }

Callers 1

checkElementMethod · 0.80

Calls 4

isArrayMethod · 0.45
reduceMethod · 0.45
filterMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected