Просмотр исходного кода

Whitespace is now removed from hex and binary even when the delimiter is set to 'None'

n1474335 7 лет назад
Родитель
Сommit
d4d12c3db0
2 измененных файлов с 4 добавлено и 5 удалено
  1. 2 1
      src/core/Utils.js
  2. 2 4
      src/core/operations/ByteRepr.js

+ 2 - 1
src/core/Utils.js

@@ -1235,7 +1235,8 @@ const Utils = {
         "Forward slash": /\//g,
         "Backslash":     /\\/g,
         "0x":            /0x/g,
-        "\\x":           /\\x/g
+        "\\x":           /\\x/g,
+        "None":          /\s+/g // Included here to remove whitespace when there shouldn't be any
     },
 
 

+ 2 - 4
src/core/operations/ByteRepr.js

@@ -288,10 +288,8 @@ const ByteRepr = {
      * @returns {byteArray}
      */
     runFromBinary: function(input, args) {
-        if (args[0] !== "None") {
-            const delimRegex = Utils.regexRep[args[0] || "Space"];
-            input = input.replace(delimRegex, "");
-        }
+        const delimRegex = Utils.regexRep[args[0] || "Space"];
+        input = input.replace(delimRegex, "");
 
         const output = [];
         const byteLen = 8;