From 0cf0a5290fe0ab0a4b5fe4bb7716655e2831895a Mon Sep 17 00:00:00 2001 From: Daniele Di Sarli <danieleds0@gmail.com> Date: Thu, 14 Sep 2017 16:32:44 +0200 Subject: [PATCH] Add built file --- lib/worker.js | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/lib/worker.js b/lib/worker.js index c8e5d68..a704f23 100644 --- a/lib/worker.js +++ b/lib/worker.js @@ -6,19 +6,11 @@ var fs = require("fs"), noop = require(path.join(__dirname, "noop.js")), events = /^(error|message)$/; -function trim(arg) { - return arg.replace(/^(\s+|\t+|\n+)|(\s+|\t+|\n+)$/g, ""); -} - -function explode(arg) { - return trim(arg).split(new RegExp("\\s*,\\s*")); -} - function toFunction(arg) { - var 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 + ")"); // eslint-disable-line no-eval - return Function.apply(Function, explode(args).concat([body])); + return __worker_evaluated_function_; } // Bootstraps the Worker -- GitLab