diff --git a/src/node/api.mjs b/src/node/api.mjs index 496570d9..59d5db0d 100644 --- a/src/node/api.mjs +++ b/src/node/api.mjs @@ -127,17 +127,16 @@ function prepareOp(opInstance, input, args) { /** - * createArgOptions + * createArgInfo * - * Create an object of options for each option or togglestring argument - * in the given operation. + * Create an object of options for each argument in the given operation * * Argument names are converted to camel case for consistency. * * @param {Operation} op - the operation to extract args from - * @returns {{}} - arrays of options for option and toggleString args. + * @returns {{}} - arrays of options for args. */ -function createArgOptions(op) { +function createArgInfo(op) { const result = {}; op.args.forEach((a) => { if (a.type === "option" || a.type === "editableOption") { @@ -173,7 +172,7 @@ function createArgOptions(op) { * @returns {Function} The operation's run function, wrapped in * some type conversion logic */ -export function wrap(OpClass) { +export function _wrap(OpClass) { // Check to see if class's run function is async. const opInstance = new OpClass(); @@ -218,7 +217,7 @@ export function wrap(OpClass) { // used in chef.help wrapped.opName = OpClass.name; - wrapped.argOptions = createArgOptions(opInstance); + wrapped.args = createArgInfo(opInstance); return wrapped; } @@ -321,7 +320,7 @@ export function bake(){ * Explain that the given operation is not included in the Node.js version. * @param {String} name - name of operation */ -export function explainExludedFunction(name) { +export function _explainExludedFunction(name) { /** * Throw new error type with useful message. */ diff --git a/src/node/config/scripts/generateNodeIndex.mjs b/src/node/config/scripts/generateNodeIndex.mjs index 3056c270..3eb2859a 100644 --- a/src/node/config/scripts/generateNodeIndex.mjs +++ b/src/node/config/scripts/generateNodeIndex.mjs @@ -40,7 +40,7 @@ let code = `/** import "babel-polyfill"; import NodeDish from "./NodeDish"; -import { wrap, help, bake, explainExludedFunction } from "./api"; +import { _wrap, help, bake, _explainExludedFunction } from "./api"; import { // import as core_ to avoid name clashes after wrap. `; @@ -74,11 +74,11 @@ function generateChef() { `; includedOperations.forEach((op) => { - code += ` "${decapitalise(op)}": wrap(core_${op}),\n`; + code += ` "${decapitalise(op)}": _wrap(core_${op}),\n`; }); excludedOperations.forEach((op) => { - code += ` "${decapitalise(op)}": explainExludedFunction("${op}"),\n`; + code += ` "${decapitalise(op)}": _explainExludedFunction("${op}"),\n`; }); code += ` };