Skip to content

Commit b4db318

Browse files
Trottrvagg
authored andcommitted
dgram: scope redeclared variables
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. PR-URL: #4940 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c397ba8 commit b4db318

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/dgram.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ function lookup6(address, callback) {
4040

4141
function newHandle(type) {
4242
if (type == 'udp4') {
43-
var handle = new UDP();
43+
const handle = new UDP();
4444
handle.lookup = lookup4;
4545
return handle;
4646
}
4747

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

212-
var err = self._handle.bind(ip, port || 0, flags);
212+
const err = self._handle.bind(ip, port || 0, flags);
213213
if (err) {
214214
var ex = exceptionWithHostPort(err, 'bind', ip, port);
215215
self.emit('error', ex);
@@ -371,7 +371,7 @@ function doSend(ex, self, ip, buffer, address, port, callback) {
371371
!!callback);
372372
if (err && callback) {
373373
// don't emit as error, dgram_legacy.js compatibility
374-
var ex = exceptionWithHostPort(err, 'send', address, port);
374+
const ex = exceptionWithHostPort(err, 'send', address, port);
375375
process.nextTick(callback, ex);
376376
}
377377
}

0 commit comments

Comments
 (0)