@@ -82,8 +82,7 @@ const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
8282let cluster ;
8383let dns ;
8484
85- const errnoException = errors . errnoException ;
86- const exceptionWithHostPort = errors . exceptionWithHostPort ;
85+ const { errnoException, exceptionWithHostPort } = errors ;
8786
8887const {
8988 kTimeout,
@@ -244,7 +243,7 @@ function Socket(options) {
244243
245244options . readable = options . readable || false ;
246245options . 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`.
250249options . allowHalfOpen = true ;
@@ -259,7 +258,7 @@ function Socket(options) {
259258this . _handle = options . handle ; // private
260259this [ async_id_symbol ] = getNewAsyncId ( this . _handle ) ;
261260} else if ( options . fd !== undefined ) {
262- const fd = options . fd ;
261+ const { fd } = options ;
263262this . _handle = createHandle ( fd , false ) ;
264263this . _handle . open ( fd ) ;
265264this [ async_id_symbol ] = this . _handle . getAsyncId ( ) ;
@@ -434,7 +433,7 @@ Socket.prototype._onTimeout = function() {
434433if ( 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 ;
438437if ( lastWriteQueueSize !== writeQueueSize ) {
439438this [ kLastWriteQueueSize ] = writeQueueSize ;
440439this . _unrefTimer ( ) ;
@@ -956,7 +955,7 @@ Socket.prototype.connect = function(...args) {
956955this . _sockname = null ;
957956}
958957
959- const path = options . path ;
958+ const { path } = options ;
960959var pipe = ! ! path ;
961960debug ( 'pipe' , pipe , path ) ;
962961
@@ -991,10 +990,8 @@ Socket.prototype.connect = function(...args) {
991990
992991
993992function lookupAndConnect ( self , options ) {
993+ var { port, localAddress, localPort } = options ;
994994var host = options . host || 'localhost' ;
995- var port = options . port ;
996- var localAddress = options . localAddress ;
997- var localPort = options . localPort ;
998995
999996if ( localAddress && ! isIP ( localAddress ) ) {
1000997throw new ERR_INVALID_IP_ADDRESS ( localAddress ) ;
0 commit comments