mirror of
https://github.com/gchq/CyberChef
synced 2025-01-07 18:18:47 +00:00
remove legacy async api from NodeRecipe
This commit is contained in:
parent
b48c16b4db
commit
6d219ade2d
2 changed files with 15 additions and 4 deletions
|
@ -30,6 +30,17 @@ class NodeDish extends Dish {
|
||||||
super(inputOrDish, type);
|
super(inputOrDish, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apply the inputted operation to the dish.
|
||||||
|
*
|
||||||
|
* @param {WrappedOperation} operation the operation to perform
|
||||||
|
* @param {*} args - any arguments for the operation
|
||||||
|
* @returns {Dish} a new dish with the result of the operation.
|
||||||
|
*/
|
||||||
|
apply(operation, args=null) {
|
||||||
|
return operation(this.value, args);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* alias for get
|
* alias for get
|
||||||
* @param args see get args
|
* @param args see get args
|
||||||
|
|
|
@ -76,14 +76,14 @@ class NodeRecipe {
|
||||||
* @param {NodeDish} dish
|
* @param {NodeDish} dish
|
||||||
* @returns {NodeDish}
|
* @returns {NodeDish}
|
||||||
*/
|
*/
|
||||||
async execute(dish) {
|
execute(dish) {
|
||||||
return await this.opList.reduce(async (prev, curr) => {
|
return this.opList.reduce((prev, curr) => {
|
||||||
// CASE where opLis item is op and args
|
// CASE where opLis item is op and args
|
||||||
if (curr.hasOwnProperty("op") && curr.hasOwnProperty("args")) {
|
if (curr.hasOwnProperty("op") && curr.hasOwnProperty("args")) {
|
||||||
return await curr.op(prev, curr.args);
|
return curr.op(prev, curr.args);
|
||||||
}
|
}
|
||||||
// CASE opList item is just op.
|
// CASE opList item is just op.
|
||||||
return await curr(prev);
|
return curr(prev);
|
||||||
}, dish);
|
}, dish);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue