From ed8eb45e260a69ad1844bcf740e1892061ea38b5 Mon Sep 17 00:00:00 2001 From: Arthur Schreiber Date: Sun, 14 Jun 2015 17:59:36 +0200 Subject: [PATCH 1/2] Remove unnecessary typeof check. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 04ba4d1..0fe96e0 100644 --- a/index.js +++ b/index.js @@ -71,7 +71,7 @@ Dissolve.prototype._exec_loop = function _exec_loop(job) { this.jobs = []; if (job.name) { - if (typeof this.vars[job.name] === "undefined") { + if (this.vars[job.name] === undefined) { this.vars[job.name] = []; } From e94b5d7d87620f95c08d80cad7bd5c49e402a203 Mon Sep 17 00:00:00 2001 From: Arthur Schreiber Date: Sun, 14 Jun 2015 18:00:14 +0200 Subject: [PATCH 2/2] Remove closure that is no longer needed. --- index.js | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) diff --git a/index.js b/index.js index 0fe96e0..8259ae8 100644 --- a/index.js +++ b/index.js @@ -75,28 +75,23 @@ Dissolve.prototype._exec_loop = function _exec_loop(job) { this.vars[job.name] = []; } - // private scope so _job doesn't get redefined later - (function() { - var _job = job; + this.jobs.push({ + type: "tap", + name: "__loop_temp", + args: [job.finish], + fn: job.fn, + }); - this.jobs.push({ - type: "tap", - name: "__loop_temp", - args: [job.finish], - fn: job.fn, - }); + this.jobs.push({ + type: "tap", + fn: function() { + if (!job.cancelled) { + this.vars[job.name].push(this.vars.__loop_temp); + } - this.jobs.push({ - type: "tap", - fn: function() { - if (!_job.cancelled) { - this.vars[_job.name].push(this.vars.__loop_temp); - } - - delete this.vars.__loop_temp; - }, - }); - }).call(this); + delete this.vars.__loop_temp; + }, + }); } else { this.jobs.push({ type: "tap",