MCPcopy Create free account
hub / github.com/EsperoTech/yaade / findScript

Function findScript

client/src/state/collections.tsx:161–174  ·  view source on GitHub ↗
(collections: Collection[], id: number)

Source from the content-addressed store, hash-verified

159}
160
161function findScript(collections: Collection[], id: number): Script | undefined {
162 for (const collection of collections) {
163 for (const script of collection.scripts ?? []) {
164 if (script.id === id) {
165 return script;
166 }
167 }
168 if (collection.children) {
169 const res = findScript(collection.children, id);
170 if (res) return res;
171 }
172 }
173 return undefined;
174}
175
176function modifyCollection(state: Collection[], id: number, f: (c: Collection) => void) {
177 const s = JSON.parse(JSON.stringify(state));

Callers 6

getCollectionsFunction · 0.90
DashboardFunction · 0.90
patchScriptDataFunction · 0.85
changeScriptOwnerFunction · 0.85
moveScriptFunction · 0.85
deleteScriptFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected