Skip to content

Commit

Permalink
Remove 'nonpayable' and stray dashes
Browse files Browse the repository at this point in the history
  • Loading branch information
Rhian committed Jun 23, 2022
1 parent 9fdde40 commit 889aee8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
10 changes: 8 additions & 2 deletions builders/argument-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ module.exports = {
for(let i in parameters) {
const parameter = parameters[i];
let paramType = "";
let regular = /\s*-\s+/;
let strippedDoc = "";
parameter.typeDescriptions.typeString.match(/struct/)
? paramType = structHelper.getStructLink(parameter.typeDescriptions.typeString.split(" ")[1])
: paramType = parameter.typeDescriptions.typeString;
Expand All @@ -22,8 +24,12 @@ module.exports = {
builder.push(" | ");
builder.push(paramType.replace("contract ", ""));
builder.push(" | ");
const doc = documentationHelper.get(documentation, "param " + parameter.name);
builder.push(doc);
const doc = documentationHelper.get(documentation, "param" + parameter.name);

doc.includes("-") ?
strippedDoc = doc.replace(regular, "") :
strippedDoc
builder.push(strippedDoc);
builder.push(" | ");
builder.push("\n");
}
Expand Down
14 changes: 11 additions & 3 deletions builders/function-code-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,21 @@ module.exports = {
builder.push("\n");
builder.push(`function ${node.name}(`);

builder.push(parameterList.join(", "));
parameterList.length > 1 ?
builder.push("\n" + parameterList.join("\n") + "\n") :
builder.push(parameterList.join(", "))

builder.push(") ");

builder.push(node.visibility.toLowerCase());
builder.push("\n" + node.visibility.toLowerCase());

builder.push(` ${node.stateMutability}`);
let stateMutability;

node.stateMutability === "nonpayable" ?
stateMutability = "" :
stateMutability = node.stateMutability

builder.push("\n" + `${stateMutability}`);

if(modifierList && modifierList.length) {
builder.push(` ${modifierList.join(" ")} `);
Expand Down
1 change: 1 addition & 0 deletions helpers/documentation-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module.exports = {
arr[1] === "struct"
? fullName = structHelper.getStructLink(arr[0])
: fullName = arr[0];

return arr.length < 2 ? fullName : `\n| ${fullName} | ${arr[1]} | ${description} |`
}

Expand Down

0 comments on commit 889aee8

Please sign in to comment.