Skip to content

Commit

Permalink
Add script to dump globals provided by a JS engine
Browse files Browse the repository at this point in the history
  • Loading branch information
Alhadis committed Oct 2, 2020
1 parent 3669a34 commit 1cbc968
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions dump-env.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh
//bin/sh -c :; exec node "$0" -- "$@"; # -*- JS -*-

import print from "./print.mjs";

const str = print(globalThis, "globalThis", {
all: true,
colours: true,
proto: true,
maxDepth: Infinity,
});

if("object" === typeof console && console && "function" === typeof console.log)
console.log(str);

else if("function" === typeof globalThis.print && globalThis.print !== print)
globalThis.print(str);

else throw str;

0 comments on commit 1cbc968

Please sign in to comment.