From 543dce57217148e99764da480d877fcacd705c24 Mon Sep 17 00:00:00 2001 From: d98762625 Date: Mon, 9 Apr 2018 11:19:05 +0100 Subject: [PATCH] remove setOps operation --- src/core/config/OperationConfig.json | 19 ------- src/core/config/modules/Default.mjs | 2 - src/core/operations/SetOps.mjs | 84 ---------------------------- src/core/operations/index.mjs | 2 - 4 files changed, 107 deletions(-) delete mode 100644 src/core/operations/SetOps.mjs diff --git a/src/core/config/OperationConfig.json b/src/core/config/OperationConfig.json index 531f7ce7..fd91946d 100644 --- a/src/core/config/OperationConfig.json +++ b/src/core/config/OperationConfig.json @@ -281,25 +281,6 @@ } ] }, - "": { - "module": "Default", - "description": "", - "inputType": "string", - "outputType": "string", - "flowControl": false, - "args": [ - { - "name": "Sample delimiter", - "type": "binaryString", - "value": "\n\n" - }, - { - "name": "Item delimiter", - "type": "binaryString", - "value": "," - } - ] - }, "Set Union": { "module": "Default", "description": "Get the union of two sets", diff --git a/src/core/config/modules/Default.mjs b/src/core/config/modules/Default.mjs index e892720e..3aaab5ad 100644 --- a/src/core/config/modules/Default.mjs +++ b/src/core/config/modules/Default.mjs @@ -13,7 +13,6 @@ import PowerSet from "../../operations/PowerSet"; import RawDeflate from "../../operations/RawDeflate"; import SetDifference from "../../operations/SetDifference"; import SetIntersection from "../../operations/SetIntersection"; -import SetOps from "../../operations/SetOps"; import SetUnion from "../../operations/SetUnion"; import ShowBase64Offsets from "../../operations/ShowBase64Offsets"; import SymmetricDifference from "../../operations/SymmetricDifference"; @@ -32,7 +31,6 @@ OpModules.Default = { "Raw Deflate": RawDeflate, "Set Difference": SetDifference, "Set Intersection": SetIntersection, - "": SetOps, "Set Union": SetUnion, "Show Base64 offsets": ShowBase64Offsets, "Symmetric Difference": SymmetricDifference, diff --git a/src/core/operations/SetOps.mjs b/src/core/operations/SetOps.mjs deleted file mode 100644 index 219c99ab..00000000 --- a/src/core/operations/SetOps.mjs +++ /dev/null @@ -1,84 +0,0 @@ -import Operation from "../Operation"; -import Utils from "../Utils"; - -/** - * - */ -class SetOp extends Operation { - - /** - * - * @param {*} runOp - */ - constructor(runOp) { - super(); - - this.module = "Default"; - this.inputType = "string"; - this.outputType = "string"; - this.args = [ - { - name: "Sample delimiter", - type: "binaryString", - value: "\n\n" - }, - { - name: "Item delimiter", - type: "binaryString", - value: "," - }, - ]; - - this.runOp = runOp; - } - - /** - * - * @param sets - */ - validateSampleNumbers(sets) { - if (!sets || (sets.length !== 2)) { - throw "Incorrect number of sets, perhaps you need to modify the sample delimiter or add more samples?"; - } - } - - /** - * - * @param {*} input - * @param {*} args - */ - run(input, args) { - - [this.sampleDelim, this.itemDelimiter] = args; - const sets = input.split(this.sampleDelim); - - try { - this.validateSampleNumbers(sets); - } catch (e) { - return e; - } - - const result = this.setOp.apply(this, sets.map(s => s.split(this.itemDelimiter))); - - // let result = { - // "Union": this.runUnion, - // "Intersection": this.runIntersect, - // "Set Difference": this.runSetDifference, - // "Symmetric Difference": this.runSymmetricDifference, - // "Cartesian Product": this.runCartesianProduct, - // "Power Set": this.runPowerSet.bind(undefined, itemDelimiter), - // }[operation] - // .apply(this, sets.map(s => s.split(itemDelimiter))); - - // Formatting issues due to the nested characteristics of power set. - // if (operation === "Power Set") { - // result = result.map(i => `${i}\n`).join(""); - // } else { - // result = result.join(itemDelimiter); - // } - - return Utils.escapeHtml(result); - } -} - -export default SetOp; diff --git a/src/core/operations/index.mjs b/src/core/operations/index.mjs index e84459e4..bd3ff94c 100644 --- a/src/core/operations/index.mjs +++ b/src/core/operations/index.mjs @@ -16,7 +16,6 @@ import RawDeflate from "./RawDeflate"; import RawInflate from "./RawInflate"; import SetDifference from "./SetDifference"; import SetIntersection from "./SetIntersection"; -import SetOps from "./SetOps"; import SetUnion from "./SetUnion"; import ShowBase64Offsets from "./ShowBase64Offsets"; import SymmetricDifference from "./SymmetricDifference"; @@ -40,7 +39,6 @@ export { RawInflate, SetDifference, SetIntersection, - SetOps, SetUnion, ShowBase64Offsets, SymmetricDifference,