@@ -24,8 +24,11 @@ class NodeRecipe {
2424
2525
2626 /**
27- * Validate an ingredient $ coerce to operation if necessary.
27+ * Validate an ingredient & coerce to operation if necessary.
2828 * @param {String | Function | Object } ing
29+ * @returns {Function || Object } The operation, or an object with the
30+ * operation and its arguments
31+ * @throws {TypeError } If it cannot find the operation in chef's list of operations.
2932 */
3033 _validateIngredient ( ing ) {
3134 // CASE operation name given. Find operation and validate
@@ -34,14 +37,15 @@ class NodeRecipe {
3437 return sanitise ( op . opName ) === sanitise ( ing ) ;
3538 } ) ;
3639 if ( op ) {
40+ // Need to validate against case 2
3741 return this . _validateIngredient ( op ) ;
3842 } else {
3943 throw new TypeError ( `Couldn't find an operation with name '${ ing } '.` ) ;
4044 }
4145 // CASE operation given. Check its a chef operation and check its not flowcontrol
4246 } else if ( typeof ing === "function" ) {
4347 if ( ing . flowControl ) {
44- throw new TypeError ( `flowControl operations like ${ ing . opName } are not currently allowed in recipes for chef.bake` ) ;
48+ throw new TypeError ( `flowControl operations like ${ ing . opName } are not currently allowed in recipes for chef.bake in the Node API ` ) ;
4549 }
4650
4751 if ( operations . includes ( ing ) ) {
@@ -63,7 +67,7 @@ class NodeRecipe {
6367
6468
6569 /**
66- * Parse config for recipe.
70+ * Parse an opList from a recipeConfig and assign it to the recipe's opList .
6771 * @param {String | Function | String[] | Function[] | [String | Function] } recipeConfig
6872 */
6973 _parseConfig ( recipeConfig ) {
0 commit comments