Skip to content

Commit

Permalink
dgram: changed 'var' to 'let' and 'const'
Browse files Browse the repository at this point in the history
PR-URL: #28357
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
mgochoa authored and targos committed Aug 2, 2019
1 parent 9b02f36 commit 9dfa636
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions lib/dgram.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,15 @@ const RECV_BUFFER = true;
const SEND_BUFFER = false;

// Lazily loaded
var cluster = null;
let cluster = null;

const errnoException = errors.errnoException;
const exceptionWithHostPort = errors.exceptionWithHostPort;


function Socket(type, listener) {
EventEmitter.call(this);
var lookup;
let lookup;
let recvBufferSize;
let sendBufferSize;

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

var address;
var exclusive;
let address;
let exclusive;

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

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

const err = state.handle.bind(ip, port || 0, flags);
if (err) {
var ex = exceptionWithHostPort(err, 'bind', ip, port);
const ex = exceptionWithHostPort(err, 'bind', ip, port);
this.emit('error', ex);
state.bindState = BIND_STATE_UNBOUND;
// Todo: close?
Expand Down Expand Up @@ -467,8 +467,8 @@ function sliceBuffer(buffer, offset, length) {
function fixBufferList(list) {
const newlist = new Array(list.length);

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

// Flush the send queue.
for (var i = 0; i < queue.length; i++)
for (let i = 0; i < queue.length; i++)
queue[i]();
}

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

var out = {};
var err = state.handle.getpeername(out);
const out = {};
const err = state.handle.getpeername(out);
if (err)
throw errnoException(err, 'getpeername');

Expand Down

0 comments on commit 9dfa636

Please sign in to comment.