aboutsummaryrefslogtreecommitdiff
path: root/docs/bqn.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/bqn.js')
-rwxr-xr-xdocs/bqn.js11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/bqn.js b/docs/bqn.js
index 007e22a1..20b76b0c 100755
--- a/docs/bqn.js
+++ b/docs/bqn.js
@@ -358,16 +358,19 @@ if (typeof process!=='undefined') {
});
}
-if (typeof module!=='undefined') {
+if (typeof module!=='undefined') { // Node.js
bqn.fmt=fmt; bqn.fmtErr=fmtErr; bqn.compile=compile; bqn.run=run;
module.exports=bqn;
+
+ let show = x => console.log(fmt(x));
+ sysvals.show = (x,w) => { show(x); return x; };
+ sysvals.out = (x,w) => { req1str("•Out",x,w);console.log(x.join("")); return x; };
+
if (!module.parent) {
let args = process.argv.slice(2);
args.map(a=>{
try {
- let out=[]; sysvals.show = (x,w) => { out.push(x); return x; }
- out.push(bqn(a));
- console.log(out.map(fmt).join('\n'));
+ show(bqn(a));
} catch(e) {
console.error(''+fmtErr(Array.from(a),e)+'');
}