From b91893d06fea80cb8a90c3c34757ba2ca62d9efd Mon Sep 17 00:00:00 2001 From: DrMaxNix Date: Fri, 9 Sep 2022 13:53:27 +0200 Subject: [PATCH] :sparkles: add pretty printer to `stderr.debug()` --- src/io.js | 8 ++++++++ src/main.js | 1 + 2 files changed, 9 insertions(+) diff --git a/src/io.js b/src/io.js index 17320a2..ff1fc3c 100644 --- a/src/io.js +++ b/src/io.js @@ -21,6 +21,14 @@ class Juicescript_io { get stderr(){ return { debug: (text, additional) => { + // PRETTY PRINT INCOMMING DATA? // + // object + if(typeof text === "object"){ + text = "Object" + "\n" + JSON.stringify(text, null, 4); + } + + + // OUTPUT // // add defaults additional ??= {}; additional.line ??= null; diff --git a/src/main.js b/src/main.js index ae56e62..062ee6f 100644 --- a/src/main.js +++ b/src/main.js @@ -110,6 +110,7 @@ class Juicescript { Run previously parsed program */ run(){ + /**/this.io.stderr.debug(this.program_tree); /**/console.log(this.program_tree); } }