Contextual-eval is a tiny JavaScript function in evaluating your expression with specified your own context.
JavaScript comes with eval
function to evaluate any expression. But unfortunately, you cannot specify the context in the evaluation.
eval(string);
contextual-eval in short ceval
is able to specify your own context by passing an extra argument.
ceval(string, context);
var value = ceval('x + y', {x: 1, y: 2});
Result
: value = 3
Contextual-eval is released under MIT License.