Simplify transpiler
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 12 Nov 2016 07:39:31 +0000 (23:39 -0800)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Sat, 12 Nov 2016 07:39:31 +0000 (23:39 -0800)
transpile.js

index ca65f2f..027e537 100644 (file)
@@ -5,17 +5,12 @@
  */
 
 const fs = require("fs"),
-      chain = JSON.parse(fs.readFileSync(process.argv[2]).toString()),
-      serialized = serialize(chain);
+      chain = JSON.parse(fs.readFileSync(process.argv[2]).toString());
 
-console.log(serialized);
+var out = [];
 
-function serialize(json) {
-    let out = [];
+Object.keys(json).forEach(A => Object.keys(json[A]).forEach(B => Object.keys(json[A][B]).forEach(C => {
+    out.push(`${A} ${B} ${C} ${json[A][B][C]}`)
+})));
 
-    Object.keys(json).forEach(A => Object.keys(json[A]).forEach(B => Object.keys(json[A][B]).forEach(C => {
-        out.push(`${A} ${B} ${C} ${json[A][B][C]}`)
-    })));
-
-    return out.join("\n");
-}
+console.log(out.join("\n"));
This page took 0.024479 seconds and 4 git commands to generate.