@@ -82,8 +82,7 @@ const kLastWriteQueueSize = Symbol('lastWriteQueueSize'); |
82 | 82 | let cluster; |
83 | 83 | let dns; |
84 | 84 |
|
85 | | -const errnoException = errors.errnoException; |
86 | | -const exceptionWithHostPort = errors.exceptionWithHostPort; |
| 85 | +const { errnoException, exceptionWithHostPort } = errors; |
87 | 86 |
|
88 | 87 | const { |
89 | 88 | kTimeout, |
@@ -244,7 +243,7 @@ function Socket(options) { |
244 | 243 |
|
245 | 244 | options.readable = options.readable || false; |
246 | 245 | options.writable = options.writable || false; |
247 | | - const allowHalfOpen = options.allowHalfOpen; |
| 246 | + const { allowHalfOpen } = options; |
248 | 247 |
|
249 | 248 | // Prevent the "no-half-open enforcer" from being inherited from `Duplex`. |
250 | 249 | options.allowHalfOpen = true; |
@@ -259,7 +258,7 @@ function Socket(options) { |
259 | 258 | this._handle = options.handle; // private |
260 | 259 | this[async_id_symbol] = getNewAsyncId(this._handle); |
261 | 260 | } else if (options.fd !== undefined) { |
262 | | - const fd = options.fd; |
| 261 | + const { fd } = options; |
263 | 262 | this._handle = createHandle(fd, false); |
264 | 263 | this._handle.open(fd); |
265 | 264 | this[async_id_symbol] = this._handle.getAsyncId(); |
@@ -434,7 +433,7 @@ Socket.prototype._onTimeout = function() { |
434 | 433 | if (lastWriteQueueSize > 0 && handle) { |
435 | 434 | // `lastWriteQueueSize !== writeQueueSize` means there is |
436 | 435 | // an active write in progress, so we suppress the timeout. |
437 | | - const writeQueueSize = handle.writeQueueSize; |
| 436 | + const { writeQueueSize } = handle; |
438 | 437 | if (lastWriteQueueSize !== writeQueueSize) { |
439 | 438 | this[kLastWriteQueueSize] = writeQueueSize; |
440 | 439 | this._unrefTimer(); |
@@ -956,7 +955,7 @@ Socket.prototype.connect = function(...args) { |
956 | 955 | this._sockname = null; |
957 | 956 | } |
958 | 957 |
|
959 | | - const path = options.path; |
| 958 | + const { path } = options; |
960 | 959 | var pipe = !!path; |
961 | 960 | debug('pipe', pipe, path); |
962 | 961 |
|
@@ -991,10 +990,8 @@ Socket.prototype.connect = function(...args) { |
991 | 990 |
|
992 | 991 |
|
993 | 992 | function lookupAndConnect(self, options) { |
| 993 | + var { port, localAddress, localPort } = options; |
994 | 994 | var host = options.host || 'localhost'; |
995 | | - var port = options.port; |
996 | | - var localAddress = options.localAddress; |
997 | | - var localPort = options.localPort; |
998 | 995 |
|
999 | 996 | if (localAddress && !isIP(localAddress)) { |
1000 | 997 | throw new ERR_INVALID_IP_ADDRESS(localAddress); |
|