From 87aeeb4b9949a3225dc9b9fa76b11f9177df80ee Mon Sep 17 00:00:00 2001 From: Macide Celik Date: Tue, 29 Oct 2019 09:13:33 +0300 Subject: [PATCH] Delete EscapeString.mjs --- src/core/operations/EscapeString.mjs | 88 ---------------------------- 1 file changed, 88 deletions(-) delete mode 100644 src/core/operations/EscapeString.mjs diff --git a/src/core/operations/EscapeString.mjs b/src/core/operations/EscapeString.mjs deleted file mode 100644 index 3ddea181..00000000 --- a/src/core/operations/EscapeString.mjs +++ /dev/null @@ -1,88 +0,0 @@ -/** - * @author Vel0x [dalemy@microsoft.com] - * @author n1474335 [n1474335@gmail.com] - * @copyright Crown Copyright 2016 - * @license Apache-2.0 - */ - -import Operation from "../Operation.mjs"; -import jsesc from "jsesc"; - -/** - * Escape string operation - */ -class EscapeString extends Operation { - - /** - * EscapeString constructor - */ - constructor() { - super(); - - this.name = "Escape string"; - this.module = "Default"; - this.description = "Escapes special characters in a string so that they do not cause conflicts. For example, Don't stop me now becomes Don\\'t stop me now.

Supports the following escape sequences:"; - this.infoURL = "https://wikipedia.org/wiki/Escape_sequence"; - this.inputType = "string"; - this.outputType = "string"; - this.args = [ - { - "name": "Escape level", - "type": "option", - "value": ["Special chars", "Everything", "Minimal"] - }, - { - "name": "Escape quote", - "type": "option", - "value": ["Single", "Double", "Backtick"] - }, - { - "name": "JSON compatible", - "type": "boolean", - "value": false - }, - { - "name": "ES6 compatible", - "type": "boolean", - "value": true - }, - { - "name": "Uppercase hex", - "type": "boolean", - "value": false - } - ]; - } - - /** - * @param {string} input - * @param {Object[]} args - * @returns {string} - * - * @example - * EscapeString.run("Don't do that", []) - * > "Don\'t do that" - * EscapeString.run(`Hello - * World`, []) - * > "Hello\nWorld" - */ - run(input, args) { - const level = args[0], - quotes = args[1], - jsonCompat = args[2], - es6Compat = args[3], - lowercaseHex = !args[4]; - - return jsesc(input, { - quotes: quotes.toLowerCase(), - es6: es6Compat, - escapeEverything: level === "Everything", - minimal: level === "Minimal", - json: jsonCompat, - lowercaseHex: lowercaseHex, - }); - } - -} - -export default EscapeString;