(collections: Collection[], id: number)
| 159 | } |
| 160 | |
| 161 | function 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 | |
| 176 | function modifyCollection(state: Collection[], id: number, f: (c: Collection) => void) { |
| 177 | const s = JSON.parse(JSON.stringify(state)); |
no outgoing calls
no test coverage detected