Skip to content
Permalink
Browse files

dgram: changed 'var' to 'let' and 'const'

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 Jun 21, 2019
1 parent 9b02f36 commit 9dfa636083e825d81b6379a4e5f5302051c7ec84
Showing with 11 additions and 11 deletions.
  1. +11 −11 lib/dgram.js
@@ -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;

@@ -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 || '';
@@ -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)
@@ -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?
@@ -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))
@@ -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]();
}

@@ -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');

0 comments on commit 9dfa636

Please sign in to comment.
You can’t perform that action at this time.