refactor format params
This commit is contained in:
parent
f7d5bd0e70
commit
8eb4d41ecd
|
@ -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() {
|
||||
|
|
Loading…
Reference in New Issue