Last active
July 20, 2020 15:26
-
-
Save gabrielschulhof/9213dd8bb88227a3bb5ee69024cdf96f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> const x = new Error(); | |
undefined | |
> const vm = require('vm'); | |
undefined | |
> vm.runInNewContext; | |
[Function: runInNewContext] | |
> vm.runInNewContext('x instanceof Error'); | |
Thrown: | |
evalmachine.<anonymous>:1 | |
x instanceof Error | |
^ | |
ReferenceError: x is not defined | |
at evalmachine.<anonymous>:1:1 | |
at Script.runInContext (vm.js:137:20) | |
at Script.runInNewContext (vm.js:143:17) | |
at Object.runInNewContext (vm.js:309:38) | |
at repl:1:4 | |
at Script.runInThisContext (vm.js:126:20) | |
at REPLServer.defaultEval (repl.js:384:29) | |
at bound (domain.js:420:14) | |
at REPLServer.runBound [as eval] (domain.js:433:12) | |
at REPLServer.onLine (repl.js:700:10) | |
> vm.runInNewContext('x instanceof Error', {x}); | |
false | |
> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment