MCPcopy Create free account
hub / github.com/PaulleDemon/PyUIBuilder / recursiveFind

Function recursiveFind

src/canvas/canvas.js:1149–1164  ·  view source on GitHub ↗
(objects)

Source from the content-addressed store, hash-verified

1147 getWidgetByIdFromWidgetList = (widgetId) => {
1148
1149 function recursiveFind(objects) {
1150 for (const obj of objects) {
1151 // Check if the current object has the matching ID
1152 if (obj.id === widgetId) {
1153 return obj // Return the object if found
1154 }
1155 // Recursively check children if they exist
1156 if (obj.children && obj.children.length > 0) {
1157 const found = recursiveFind(obj.children)
1158 if (found) {
1159 return found // Return the found object from children
1160 }
1161 }
1162 }
1163 return null // Return null if not found
1164 }
1165
1166 return recursiveFind(this.widgets)
1167 }

Callers 1

canvas.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected