MCPcopy Create free account
hub / github.com/MankaiHuang/screen-visualization / find

Function find

public/iframe/lib/js/commonFun.js:122–140  ·  view source on GitHub ↗
(node)

Source from the content-addressed store, hash-verified

120 // 因为存在children的情况 因此这里要遍历所有元素去查找
121 const nowTemplate = []
122 const find = (node) => { // 匿名函数防止this指向错误
123 node.some(item => {
124 const { type, componentsType, option, children, elementId } = item.property
125 if (type !== 'group') {
126 if (elementId === id) {
127 nowTemplate.push(item);
128 return true
129 }
130 if (componentsType === "private") {
131 // 如果是私有组件 则取 option.templatelist
132 find(option.templateList)
133 }
134 }
135 if (type === 'group' && children.length > 0) {
136 find(children)
137 }
138
139 })
140 }
141 find(templateList)
142 if (nowTemplate.length > 0) {
143 return nowTemplate[0]

Callers 4

findTemplateForIdFunction · 0.70
findGroupForIdFunction · 0.70
getParentGroupPropertyFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected