Explorar el Código

Merge pull request #36 from hazzik/remove-redundant-J

Remove redundant `J` optimization
Martin Kleppe hace 10 años
padre
commit
b5e11779c4
Se han modificado 2 ficheros con 9 adiciones y 19 borrados
  1. 8 18
      jsfuck.js
  2. 1 1
      output.txt

+ 8 - 18
jsfuck.js

@@ -60,7 +60,7 @@
     'G':   '(false+Function("return Date")()())[30]',
     'H':   USE_CHAR_CODE,
     'I':   '(Infinity+"")[0]',
-    //'J':   USE_CHAR_CODE,
+    'J':   USE_CHAR_CODE,
     'K':   USE_CHAR_CODE,
     'L':   USE_CHAR_CODE,
     'M':   '(true+Function("return Date")()())[30]',
@@ -260,23 +260,13 @@
         if (replacement){
           output.push(replacement);
         } else {
-          if (c === "J") {
-            replacement =
-              "([][" + encode("filter") + "]" +
-              "[" + encode("constructor") + "]" +
-              "(" + encode("return new Date(200000000)") + ")()+[])[!+[]+!+[]+!+[]+!+[]]";
-     
-            output.push(replacement);
-            MAPPING[c] = replacement;
-          } else {
-            replacement =
-              "([]+[])[" + encode("constructor") + "]" +
-              "[" + encode("fromCharCode") + "]" +
-              "(" + encode(c.charCodeAt(0) + "") + ")";
-     
-            output.push(replacement);
-            MAPPING[c] = replacement;
-          }
+          replacement =
+            "([]+[])[" + encode("constructor") + "]" +
+            "[" + encode("fromCharCode") + "]" +
+            "(" + encode(c.charCodeAt(0) + "") + ")";
+   
+          output.push(replacement);
+          MAPPING[c] = replacement;
         }
       }
     });

+ 1 - 1
output.txt

@@ -40,7 +40,7 @@
 `G` 4810
 `H` 6447
 `I` 70
-`J` 7130
+`J` 6418
 `K` 8049
 `L` 6547
 `M` 4811