From 4773b6577aae8bde40a122274e96ca4d7f80b16e Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Tue, 15 Apr 2014 09:19:07 -0300 Subject: [PATCH] add getArgTypes command Which allows you to see what arguments you need to pass to a function. --- bin/Copay.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/bin/Copay.js b/bin/Copay.js index 2dde15ddf..763e68626 100644 --- a/bin/Copay.js +++ b/bin/Copay.js @@ -84,6 +84,24 @@ Copay.prototype.getBalance.argTypes = ]; */ +Copay.prototype.getArgTypes = function getArgTypes(command, callback) { + var self = this; + checkArgs(arguments.callee.name, arguments); + + if (command[0] == '_' || typeof Copay.prototype[command] != 'function') + return callback(new Error('Invalid command')); + + var argTypes = Copay.prototype[command].argTypes; + + return callback(null, argTypes); +}; + +Copay.prototype.getArgTypes.argTypes = + [ + ['command', 'string'], + ['callback', 'function'] + ]; + Copay.prototype.getCommands = function getCommands(callback) { var self = this; checkArgs(arguments.callee.name, arguments);