You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
vm: filename option to vm.runInNewContext() ignored #27055
Looking at it from another perspective, maybe it's just a documentation issue? From vm.md:
## vm.runInNewContext(code[, sandbox[, options]])
To me that reads as saying the sandbox argument can be omitted but I think it should be interpreted as "sandbox can be omitted only when options is"? It's not super clear, you can't really divine it from the description either.
Thinking about it more, I don't see a way of making it work the way I expected it to (no way to know if the second arg is the sandbox or the options object in a two arg call) so I'll go ahead and close this out and think about how to improve the docs.
Activity
bnoordhuis commentedon Apr 2, 2019
Looking at it from another perspective, maybe it's just a documentation issue? From vm.md:
## vm.runInNewContext(code[, sandbox[, options]])To me that reads as saying the
sandboxargument can be omitted but I think it should be interpreted as "sandboxcan be omitted only whenoptionsis"? It's not super clear, you can't really divine it from the description either.bnoordhuis commentedon Apr 2, 2019
Thinking about it more, I don't see a way of making it work the way I expected it to (no way to know if the second arg is the sandbox or the options object in a two arg call) so I'll go ahead and close this out and think about how to improve the docs.