From c36c268fc7607e50c3566d5e0867d1e811da67be Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Sun, 27 Oct 2019 23:33:01 +0300 Subject: [PATCH] Delete AddLineNumbers.mjs --- src/core/operations/AddLineNumbers.mjs | 46 -------------------------- 1 file changed, 46 deletions(-) delete mode 100644 src/core/operations/AddLineNumbers.mjs diff --git a/src/core/operations/AddLineNumbers.mjs b/src/core/operations/AddLineNumbers.mjs deleted file mode 100644 index c1c6159a..00000000 --- a/src/core/operations/AddLineNumbers.mjs +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @author n1474335 [n1474335@gmail.com] - * @copyright Crown Copyright 2016 - * @license Apache-2.0 - */ - -import Operation from "../Operation.mjs"; - -/** - * Add line numbers operation - */ -class AddLineNumbers extends Operation { - - /** - * AddLineNumbers constructor - */ - constructor() { - super(); - - this.name = "Add line numbers"; - this.module = "Default"; - this.description = "Adds line numbers to the output."; - this.inputType = "string"; - this.outputType = "string"; - this.args = []; - } - - /** - * @param {string} input - * @param {Object[]} args - * @returns {string} - */ - run(input, args) { - const lines = input.split("\n"), - width = lines.length.toString().length; - let output = ""; - - for (let n = 0; n < lines.length; n++) { - output += (n+1).toString().padStart(width, " ") + " " + lines[n] + "\n"; - } - return output.slice(0, output.length-1); - } - -} - -export default AddLineNumbers;