EVAL

Copyright(c) 2013 Stefano Balietti MIT Licensed

Collection of static functions related to the evaluation

of strings as javascript commands

(function(JSUS) {

function EVAL(){};

EVAL.eval

Allows to execute the eval function within a given context.

If no context is passed a reference, this is used.

Params
str string The command to executes
context object Optional. The context of execution. Defaults, this
Returns
mixed The return value of the executed commands
See
eval
See
JSON.parse
EVAL.eval = function(str, context) {
    var func;
    if (!str) return;
    context = context || this;

Eval must be called indirectly i.e. eval.call is not possible

    func = function(str) {

TODO: Filter str

        return eval(str);
    }
    return func.call(context, str);
};

JSUS.extend(EVAL);

})('undefined' !== typeof JSUS ? JSUS : module.parent.exports.JSUS);