Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 46d1025

Browse filesBrowse files
starkwangaddaleax
authored andcommitted
net: use object destructuring
PR-URL: #20959 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent d4787cf commit 46d1025
Copy full SHA for 46d1025

File tree

Expand file treeCollapse file tree

1 file changed

+6
-9
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-9
lines changed
Open diff view settings
Collapse file

‎lib/net.js‎

Copy file name to clipboardExpand all lines: lib/net.js
+6-9Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@ const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
8282
let cluster;
8383
let dns;
8484

85-
const errnoException = errors.errnoException;
86-
const exceptionWithHostPort = errors.exceptionWithHostPort;
85+
const { errnoException, exceptionWithHostPort } = errors;
8786

8887
const {
8988
kTimeout,
@@ -244,7 +243,7 @@ function Socket(options) {
244243

245244
options.readable = options.readable || false;
246245
options.writable = options.writable || false;
247-
const allowHalfOpen = options.allowHalfOpen;
246+
const { allowHalfOpen } = options;
248247

249248
// Prevent the "no-half-open enforcer" from being inherited from `Duplex`.
250249
options.allowHalfOpen = true;
@@ -259,7 +258,7 @@ function Socket(options) {
259258
this._handle = options.handle; // private
260259
this[async_id_symbol] = getNewAsyncId(this._handle);
261260
} else if (options.fd !== undefined) {
262-
const fd = options.fd;
261+
const { fd } = options;
263262
this._handle = createHandle(fd, false);
264263
this._handle.open(fd);
265264
this[async_id_symbol] = this._handle.getAsyncId();
@@ -434,7 +433,7 @@ Socket.prototype._onTimeout = function() {
434433
if (lastWriteQueueSize > 0 && handle) {
435434
// `lastWriteQueueSize !== writeQueueSize` means there is
436435
// an active write in progress, so we suppress the timeout.
437-
const writeQueueSize = handle.writeQueueSize;
436+
const { writeQueueSize } = handle;
438437
if (lastWriteQueueSize !== writeQueueSize) {
439438
this[kLastWriteQueueSize] = writeQueueSize;
440439
this._unrefTimer();
@@ -956,7 +955,7 @@ Socket.prototype.connect = function(...args) {
956955
this._sockname = null;
957956
}
958957

959-
const path = options.path;
958+
const { path } = options;
960959
var pipe = !!path;
961960
debug('pipe', pipe, path);
962961

@@ -991,10 +990,8 @@ Socket.prototype.connect = function(...args) {
991990

992991

993992
function lookupAndConnect(self, options) {
993+
var { port, localAddress, localPort } = options;
994994
var host = options.host || 'localhost';
995-
var port = options.port;
996-
var localAddress = options.localAddress;
997-
var localPort = options.localPort;
998995

999996
if (localAddress && !isIP(localAddress)) {
1000997
throw new ERR_INVALID_IP_ADDRESS(localAddress);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.