From 96e40a6479ec37b0a180439230794cdd6932fd7c Mon Sep 17 00:00:00 2001 From: Matt C Date: Mon, 27 Mar 2017 20:30:32 +0000 Subject: [PATCH] Made requested changes. --- src/js/config/OperationConfig.js | 4 ++-- src/js/core/Utils.js | 32 -------------------------------- src/js/operations/ByteRepr.js | 13 +++++-------- 3 files changed, 7 insertions(+), 42 deletions(-) diff --git a/src/js/config/OperationConfig.js b/src/js/config/OperationConfig.js index 153a48ee..4957610e 100755 --- a/src/js/config/OperationConfig.js +++ b/src/js/config/OperationConfig.js @@ -432,7 +432,7 @@ var OperationConfig = { { name: "Delimiter", type: "option", - value: ByteRepr.OCT_DELIM_OPTIONS + value: ByteRepr.DELIM_OPTIONS } ] }, @@ -447,7 +447,7 @@ var OperationConfig = { { name: "Delimiter", type: "option", - value: ByteRepr.OCT_DELIM_OPTIONS + value: ByteRepr.DELIM_OPTIONS } ] }, diff --git a/src/js/core/Utils.js b/src/js/core/Utils.js index c9ce1b0b..405249a1 100755 --- a/src/js/core/Utils.js +++ b/src/js/core/Utils.js @@ -828,38 +828,6 @@ var Utils = { }, - /** - * Convert an byte array into a octal string - * - * @author Matt C [matt@artemisbot.pw] - * @param {byteArray} data - * @param {string} [delim] - * @returns {string} - * - */ - toOct: function(data, delim) { - var output = ""; - delim = delim || "Space"; - data.map(val => output += (parseInt(Utils.bin(val), 2).toString(8) + delim)); - return output.slice(0, -delim.length); - }, - - - /** - * Convert an Octal string into a byte array. - * - * @author Matt C [matt@artemisbot.pw] - * @param {string} data - * @param {string} [delim] - * @returns {byteArray} - * - */ - fromOct: function(data, delim) { - delim = delim || "Space"; - return data.split(delim).map(val => parseInt(val, 8)); - }, - - /** * Parses CSV data and returns it as a two dimensional array or strings. * diff --git a/src/js/operations/ByteRepr.js b/src/js/operations/ByteRepr.js index 5a1fdb93..8bdf398f 100755 --- a/src/js/operations/ByteRepr.js +++ b/src/js/operations/ByteRepr.js @@ -21,11 +21,6 @@ var ByteRepr = { * @default */ HEX_DELIM_OPTIONS: ["Space", "Comma", "Semi-colon", "Colon", "Line feed", "CRLF", "0x", "\\x", "None"], - /** - * @constant - * @default - */ - OCT_DELIM_OPTIONS: ["Space", "Comma", "Semi-colon", "Colon", "Line feed", "CRLF"], /** * @constant * @default @@ -67,8 +62,10 @@ var ByteRepr = { * @returns {string} */ runToOct: function(input, args) { - var delim = Utils.charRep[args[0] || "Space"]; - return Utils.toOct(input, delim, 2); + var delim = Utils.charRep[args[0] || "Space"], + output = ""; + input.map(val => output += (parseInt(Utils.bin(val), 2).toString(8) + delim)); + return output.slice(0, -delim.length); }, /** @@ -81,7 +78,7 @@ var ByteRepr = { */ runFromOct: function(input, args) { var delim = Utils.charRep[args[0] || "Space"]; - return Utils.fromOct(input, delim); + return input.split(delim).map(val => parseInt(val, 8)); }, /**