From 243395d319f70972ed8f746f6a23217fcfc7f6ad Mon Sep 17 00:00:00 2001 From: ElementG9 Date: Fri, 6 Dec 2019 10:44:49 -0700 Subject: [PATCH] Make things able to change data --- bin/pivot.js | 3 ++- src/code.js | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bin/pivot.js b/bin/pivot.js index b673125..0fd7c3d 100755 --- a/bin/pivot.js +++ b/bin/pivot.js @@ -29,7 +29,8 @@ if (typeof args[0] != 'undefined') { }; repl('> ', (answer) => { let jsAnswer = code.translate(parser.parse(tokenizer.tokenize(answer)), data); + data = jsAnswer.data; // console.log(require('util').inspect(jsAnswer, { depth: null })); - eval(jsAnswer); + eval(jsAnswer.code); }); } diff --git a/src/code.js b/src/code.js index f756cf6..57624a2 100644 --- a/src/code.js +++ b/src/code.js @@ -30,7 +30,10 @@ function translate(ast, data) { out += temp; } } - return out; + return { + data, + code: out + }; } module.exports = {