(shot, systems)
| 49 | * @returns {AbstractCommand[]} The commands to run at the start and end of the shot. |
| 50 | */ |
| 51 | const parseSetup = (shot, systems) => |
| 52 | Object.values(systems) |
| 53 | .filter(sys => sys !== undefined && typeof sys.parseSetupShot === 'function') |
| 54 | .reduce((commands, sys) => { |
| 55 | const systemCommands = sys.parseSetupShot(shot) |
| 56 | if (!Array.isArray(systemCommands)) { |
| 57 | throw new Error('Your system should always return an array of commands for a systemSetup') |
| 58 | } |
| 59 | return [...commands, ...systemCommands] |
| 60 | } |
| 61 | , []) |
| 62 | |
| 63 | /** |
| 64 | * Returns an array of commands. |
no test coverage detected