Skip to content

Commit

Permalink
Made replacing the text optional
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaebert committed Oct 19, 2024
1 parent e8fb73c commit 479bb60
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/core/operations/Print.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class Print extends Operation {

this.name = "Print";
this.module = "Other";
this.description = "Prints a register";
this.description = "Prints a text to the output.";
this.infoURL = ""; // Usually a Wikipedia link. Remember to remove localisation (i.e. https://wikipedia.org/etc rather than https://en.wikipedia.org/etc)
this.inputType = "string";
this.outputType = "string";
Expand All @@ -28,6 +28,11 @@ class Print extends Operation {
name: "Text to print",
type: "string",
value: ""
},
{
name: "Replace",
type: "boolean",
value: true
}
];
}
Expand All @@ -38,11 +43,11 @@ class Print extends Operation {
* @returns {string}
*/
run(input, args) {
console.log(args);

//input = args[0].value;
//return input;
return args[0].toString();
const [text, replace] = args;
if (replace) {
return text.toString();
}
return input + text.toString();
}

}
Expand Down

0 comments on commit 479bb60

Please sign in to comment.