diff --git a/lib/domain.js b/lib/domain.js index b980f8452c2113..3a5d7614c4f4cb 100644 --- a/lib/domain.js +++ b/lib/domain.js @@ -204,7 +204,7 @@ Domain.prototype.members = undefined; // Called by process._fatalException in case an error was thrown. Domain.prototype._errorHandler = function(er) { - var caught = false; + let caught = false; if ((typeof er === 'object' && er !== null) || typeof er === 'function') { Object.defineProperty(er, 'domain', { @@ -324,7 +324,7 @@ Domain.prototype.add = function(ee) { // e.add(d); // e.emit('error', er); // RangeError, stack overflow! if (this.domain && (ee instanceof Domain)) { - for (var d = this.domain; d; d = d.domain) { + for (let d = this.domain; d; d = d.domain) { if (ee === d) return; } } @@ -348,14 +348,14 @@ Domain.prototype.remove = function(ee) { Domain.prototype.run = function(fn) { - var ret; + let ret; this.enter(); if (arguments.length >= 2) { - var len = arguments.length; - var args = new Array(len - 1); + const len = arguments.length; + const args = new Array(len - 1); - for (var i = 1; i < len; i++) + for (let i = 1; i < len; i++) args[i - 1] = arguments[i]; ret = fn.apply(this, args); @@ -370,7 +370,7 @@ Domain.prototype.run = function(fn) { function intercepted(_this, self, cb, fnargs) { if (fnargs[0] && fnargs[0] instanceof Error) { - var er = fnargs[0]; + const er = fnargs[0]; er.domainBound = cb; er.domainThrown = false; Object.defineProperty(er, 'domain', { @@ -384,11 +384,11 @@ function intercepted(_this, self, cb, fnargs) { } const args = []; - var i, ret; + let ret; self.enter(); if (fnargs.length > 1) { - for (i = 1; i < fnargs.length; i++) + for (let i = 1; i < fnargs.length; i++) args.push(fnargs[i]); ret = cb.apply(_this, args); } else { @@ -412,7 +412,7 @@ Domain.prototype.intercept = function(cb) { function bound(_this, self, cb, fnargs) { - var ret; + let ret; self.enter(); if (fnargs.length > 0)