Browse Source

remove setOps operation

d98762625 7 years ago
parent
commit
543dce5721

+ 0 - 19
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",

+ 0 - 2
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,

+ 0 - 84
src/core/operations/SetOps.mjs

@@ -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;

+ 0 - 2
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,