I'm trying to find a way to set a custom environment to a function in Node.JS.
For example:
var context = { // Define env for the function
foo: function(){
return "bar"
},
test: function(arg){
doThings(arg);
}
}
var func = function(){ // Define the function
test(foo());
}
setCustomEnv(func,context) // Inject the function into the function (and if possible run it)