(tasks, target, args)
| 226 | // @param args Array of arguments to be passed to the functions. (The |
| 227 | // same arguments will be passed to all functions.) |
| 228 | function evalAndRun(tasks, target, args) { |
| 229 | if (tasks) { |
| 230 | forEach(tasks, function(task) { |
| 231 | var theseArgs = args; |
| 232 | if (typeof(task) === "object") { |
| 233 | theseArgs = theseArgs.concat([task.data]); |
| 234 | task = task.code; |
| 235 | } |
| 236 | var taskFunc = tryEval(task); |
| 237 | if (typeof(taskFunc) !== "function") { |
| 238 | throw new Error("Task must be a function! Source:\n" + task); |
| 239 | } |
| 240 | taskFunc.apply(target, theseArgs); |
| 241 | }); |
| 242 | } |
| 243 | } |
| 244 | |
| 245 | // Attempt eval() both with and without enclosing in parentheses. |
| 246 | // Note that enclosing coerces a function declaration into |
no test coverage detected