JS-Interpreter
JS-Interpreter copied to clipboard
Fallback to globalThis in acorn.js if this is not available
This increases compatibility of the included acorn.js file to support environments that don't support a root this object (e.g., Deno) by falling back to globalThis if this is not defined.
When using the base JS-Interpreter with Deno, the following error happens:
error: TypeError: Cannot read properties of undefined (reading 'acorn')
mod(root.acorn || (root.acorn = {})); // Plain browser env
^
at https://raw.githubusercontent.com/NeilFraser/JS-Interpreter/10a8cf5e613834b5d36655c1921f818455fc324a/acorn.js:32:12
at https://raw.githubusercontent.com/NeilFraser/JS-Interpreter/10a8cf5e613834b5d36655c1921f818455fc324a/acorn.js:33:3
This patch resolves the error.