diff --git a/src/worker.js b/src/worker.js index 907f620083cd733719d58655b24f3347523ca0aa..d76e761a1e2bd5c824dc7b6deaed802c85c90596 100644 --- a/src/worker.js +++ b/src/worker.js @@ -13,10 +13,10 @@ function explode (arg) { } function toFunction (arg) { - const args = trim(arg.replace(/^.*\(/, "").replace(/[\t|\r|\n|\"|\']+/g, "").replace(/\).*/, "")), - body = trim(arg.replace(/^.*\{/, "").replace(/\}$/, "")); + var __worker_evaluated_function_ = null; + eval('__worker_evaluated_function_ = (' + arg + ')') - return Function.apply(Function, explode(args).concat([body])); + return __worker_evaluated_function_; } // Bootstraps the Worker