From aeeb459eac8f7e363d45d06d3ae8dea2afd54b38 Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 1 Aug 2018 15:16:41 -0400 Subject: [PATCH] refactor format params --- lib/modules/profiler/index.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/lib/modules/profiler/index.js b/lib/modules/profiler/index.js index 6f2ab05d..3f260c5a 100644 --- a/lib/modules/profiler/index.js +++ b/lib/modules/profiler/index.js @@ -24,21 +24,14 @@ class Profiler { let table = new asciiTable(contractName); table.setHeading('Function', 'Payable', 'Mutability', 'Inputs', 'Outputs', 'Gas Estimates'); profileObj.methods.forEach((method) => { - table.addRow(method.name, method.payable, method.mutability, method.inputs, method.outputs, method.gasEstimates); + table.addRow(method.name, method.payable, method.mutability, self.formatParams(method.inputs), self.formatParams(method.outputs), method.gasEstimates); }); callback(null, table.toString()); }); } formatParams(params) { - if (!params || !params.length) { - return "()"; - } - let paramString = "("; - let mappedParams = params.map(param => param.type); - paramString += mappedParams.join(','); - paramString += ")"; - return paramString; + return "(" + (params || []).map(param => param.type).join(',') + ")"; } registerConsoleCommand() {