Skip to content

Commit

Permalink
dgram: scope redeclared variables
Browse files Browse the repository at this point in the history
A few variables in `lib/dgram.js` are redeclared with `var` in a scope
where they have already been declared. These instances can be scoped
more narrowly with `const`, so that's what this change does.
  • Loading branch information
Trott committed Jan 29, 2016
1 parent 9429685 commit de3c655
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ function lookup6(address, callback) {

function newHandle(type) {
if (type == 'udp4') {
var handle = new UDP();
const handle = new UDP();
handle.lookup = lookup4;
return handle;
}

if (type == 'udp6') {
var handle = new UDP();
const handle = new UDP();
handle.lookup = lookup6;
handle.bind = handle.bind6;
handle.send = handle.send6;
Expand Down Expand Up @@ -209,7 +209,7 @@ Socket.prototype.bind = function(port_ /*, address, callback*/) {
if (!self._handle)
return; // handle has been closed in the mean time

var err = self._handle.bind(ip, port || 0, flags);
const err = self._handle.bind(ip, port || 0, flags);
if (err) {
var ex = exceptionWithHostPort(err, 'bind', ip, port);
self.emit('error', ex);
Expand Down Expand Up @@ -332,7 +332,7 @@ Socket.prototype.send = function(buffer,
!!callback);
if (err && callback) {
// don't emit as error, dgram_legacy.js compatibility
var ex = exceptionWithHostPort(err, 'send', address, port);
const ex = exceptionWithHostPort(err, 'send', address, port);
process.nextTick(callback, ex);
}
}
Expand Down

0 comments on commit de3c655

Please sign in to comment.