From e8fb73ca6c881b65083757f91b59e2c8324ecaf3 Mon Sep 17 00:00:00 2001 From: Joshua Ebert Date: Sat, 19 Oct 2024 13:02:20 +0200 Subject: [PATCH] Added Print --- src/core/config/Categories.json | 3 +- src/core/operations/Print.mjs | 50 +++++++++++++++++++++++++++++++++ 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 src/core/operations/Print.mjs diff --git a/src/core/config/Categories.json b/src/core/config/Categories.json index bebdd6a5..1f96e2ab 100644 --- a/src/core/config/Categories.json +++ b/src/core/config/Categories.json @@ -537,7 +537,8 @@ "HTML To Text", "Generate Lorem Ipsum", "Numberwang", - "XKCD Random Number" + "XKCD Random Number", + "Print" ] }, { diff --git a/src/core/operations/Print.mjs b/src/core/operations/Print.mjs new file mode 100644 index 00000000..d2b1972a --- /dev/null +++ b/src/core/operations/Print.mjs @@ -0,0 +1,50 @@ +/** + * @author Joshua [ebert.joshua@protonmail.com] + * @copyright Crown Copyright 2024 + * @license Apache-2.0 + */ + +import Operation from "../Operation.mjs"; + +/** + * Print operation + */ +class Print extends Operation { + + /** + * Print constructor + */ + constructor() { + super(); + + this.name = "Print"; + this.module = "Other"; + this.description = "Prints a register"; + 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"; + this.args = [ + { + name: "Text to print", + type: "string", + value: "" + } + ]; + } + + /** + * @param {string} input + * @param {Object[]} args + * @returns {string} + */ + run(input, args) { + console.log(args); + + //input = args[0].value; + //return input; + return args[0].toString(); + } + +} + +export default Print;