mhenke1 commented on a change in pull request #136: Global scope eval.
URL:
https://github.com/apache/incubator-openwhisk-runtime-nodejs/pull/136#discussion_r294882679
##########
File path: core/nodejsActionBase/runner.js
##########
@@ -169,4 +169,16 @@ function assertMainIsFunction(userScriptMain, main) {
}
}
+/**
+ * Evals the code to execute. This is a global function so that the eval is in
the global context
+ * and hence functions which use variables without 'var' are permitted.
+ */
+function evalScript(main, whatToRequire, code) {
Review comment:
Might be more concise to move `whatToRequire`to the end of the parameter
list and call `evalScript`with three parameters in the first case and with two
parameters in the `plain old JS case`. Your `if`statement would work as
expected still.
Other than that the change does look fine.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services