Skip to content

Commit 9dfa636

Browse files
mgochoatargos
authored andcommitted
dgram: changed 'var' to 'let' and 'const'
PR-URL: #28357 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Rich Trott <[email protected]>
1 parent 9b02f36 commit 9dfa636

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/dgram.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,15 @@ const RECV_BUFFER = true;
7979
const SEND_BUFFER = false;
8080

8181
// Lazily loaded
82-
var cluster = null;
82+
let cluster = null;
8383

8484
const errnoException = errors.errnoException;
8585
const exceptionWithHostPort = errors.exceptionWithHostPort;
8686

8787

8888
function Socket(type, listener) {
8989
EventEmitter.call(this);
90-
var lookup;
90+
let lookup;
9191
let recvBufferSize;
9292
let sendBufferSize;
9393

@@ -262,8 +262,8 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
262262
return this;
263263
}
264264

265-
var address;
266-
var exclusive;
265+
let address;
266+
let exclusive;
267267

268268
if (port !== null && typeof port === 'object') {
269269
address = port.address || '';
@@ -293,7 +293,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
293293
if (!cluster)
294294
cluster = require('cluster');
295295

296-
var flags = 0;
296+
let flags = 0;
297297
if (state.reuseAddr)
298298
flags |= UV_UDP_REUSEADDR;
299299
if (state.ipv6Only)
@@ -318,7 +318,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
318318

319319
const err = state.handle.bind(ip, port || 0, flags);
320320
if (err) {
321-
var ex = exceptionWithHostPort(err, 'bind', ip, port);
321+
const ex = exceptionWithHostPort(err, 'bind', ip, port);
322322
this.emit('error', ex);
323323
state.bindState = BIND_STATE_UNBOUND;
324324
// Todo: close?
@@ -467,8 +467,8 @@ function sliceBuffer(buffer, offset, length) {
467467
function fixBufferList(list) {
468468
const newlist = new Array(list.length);
469469

470-
for (var i = 0, l = list.length; i < l; i++) {
471-
var buf = list[i];
470+
for (let i = 0, l = list.length; i < l; i++) {
471+
const buf = list[i];
472472
if (typeof buf === 'string')
473473
newlist[i] = Buffer.from(buf);
474474
else if (!isUint8Array(buf))
@@ -514,7 +514,7 @@ function clearQueue() {
514514
state.queue = undefined;
515515

516516
// Flush the send queue.
517-
for (var i = 0; i < queue.length; i++)
517+
for (let i = 0; i < queue.length; i++)
518518
queue[i]();
519519
}
520520

@@ -732,8 +732,8 @@ Socket.prototype.remoteAddress = function() {
732732
if (state.connectState !== CONNECT_STATE_CONNECTED)
733733
throw new ERR_SOCKET_DGRAM_NOT_CONNECTED();
734734

735-
var out = {};
736-
var err = state.handle.getpeername(out);
735+
const out = {};
736+
const err = state.handle.getpeername(out);
737737
if (err)
738738
throw errnoException(err, 'getpeername');
739739

0 commit comments

Comments
 (0)