(state: Collection[], id: number, data: any)
| 471 | } |
| 472 | |
| 473 | function patchScriptData(state: Collection[], id: number, data: any): Collection[] { |
| 474 | const oldScript = findScript(state, id); |
| 475 | if (!oldScript) return state; |
| 476 | return modifyCollection(state, oldScript.collectionId, (c) => { |
| 477 | if (!c.scripts) return; |
| 478 | for (const script of c.scripts) { |
| 479 | if (script.id === id) { |
| 480 | script.data = { ...script.data, ...data }; |
| 481 | return; |
| 482 | } |
| 483 | } |
| 484 | }); |
| 485 | } |
| 486 | |
| 487 | function changeScriptOwner( |
| 488 | state: Collection[], |
no test coverage detected