I have an application server written in JavaScript(node.js) . I accept a JS function code as an input from the web browser. Now I want to be able to run this function on server without affecting anything else.
I want to make sure that all the variables this function is modifying are local to the function and not affecting any other vars on server.
Also I would like to somehow avoid infinite loops or recursions and any other unforseen problems.
Mostly I would like the user to be able to trigger some code as a function to be run before I take some action.
Any ideas ?