UNPKG

555 BJavaScriptView Raw
1const eachAsync = require('series-async-each');
2const loadCommand = require('./loadCommand');
3
4const executeCommand = async (app, command, executionParams) => {
5
6 if (command.composedOf) {
7 await eachAsync(command.composedOf, async (subcommandName) => {
8 const subcommand = loadCommand(app, subcommandName);
9 await executeCommand(
10 app,
11 subcommand,
12 Object.assign(executionParams, command.composingParams)
13 );
14 });
15 } else {
16 await command.execute(executionParams);
17 }
18};
19
20module.exports = executeCommand;