WIP HAD to move NodeDish out - NONE of it is async!

This commit is contained in:
d98762625 2019-02-15 15:20:05 +00:00
parent aafde8986d
commit 04b7f2fa8c
16 changed files with 442 additions and 411 deletions

View file

@ -9,7 +9,7 @@ import { sanitise } from "./apiUtils";
/**
* Similar to core/Recipe, Recipe controls a list of operations and
* the SyncDish the operate on. However, this Recipe is for the node
* the NodeDish the operate on. However, this Recipe is for the node
* environment.
*/
class NodeRecipe {
@ -73,17 +73,17 @@ class NodeRecipe {
/**
* Run the dish through each operation, one at a time.
* @param {SyncDish} dish
* @returns {SyncDish}
* @param {NodeDish} dish
* @returns {NodeDish}
*/
execute(dish) {
return this.opList.reduce((prev, curr) => {
async execute(dish) {
return await this.opList.reduce(async (prev, curr) => {
// CASE where opLis item is op and args
if (curr.hasOwnProperty("op") && curr.hasOwnProperty("args")) {
return curr.op(prev, curr.args);
return await curr.op(prev, curr.args);
}
// CASE opList item is just op.
return curr(prev);
return await curr(prev);
}, dish);
}
}