@@ -106,7 +106,7 @@ OutgoingMessage.prototype._send = function(data, encoding, callback) {
106106 // the same packet. Future versions of Node are going to take care of
107107 // this at a lower level and in a more general way.
108108 if ( ! this . _headerSent ) {
109- if ( util . isString ( data ) &&
109+ if ( typeof data === 'string' &&
110110 encoding !== 'hex' &&
111111 encoding !== 'base64' ) {
112112 data = this . _header + data ;
@@ -122,13 +122,13 @@ OutgoingMessage.prototype._send = function(data, encoding, callback) {
122122
123123
124124OutgoingMessage . prototype . _writeRaw = function ( data , encoding , callback ) {
125- if ( util . isFunction ( encoding ) ) {
125+ if ( typeof encoding === 'function' ) {
126126 callback = encoding ;
127127 encoding = null ;
128128 }
129129
130130 if ( data . length === 0 ) {
131- if ( util . isFunction ( callback ) )
131+ if ( typeof callback === 'function' )
132132 process . nextTick ( callback ) ;
133133 return true ;
134134 }
@@ -187,7 +187,7 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
187187
188188 if ( headers ) {
189189 var keys = Object . keys ( headers ) ;
190- var isArray = util . isArray ( headers ) ;
190+ var isArray = Array . isArray ( headers ) ;
191191 var field , value ;
192192
193193 for ( var i = 0 , l = keys . length ; i < l ; i ++ ) {
@@ -200,7 +200,7 @@ OutgoingMessage.prototype._storeHeader = function(firstLine, headers) {
200200 value = headers [ key ] ;
201201 }
202202
203- if ( util . isArray ( value ) ) {
203+ if ( Array . isArray ( value ) ) {
204204 for ( var j = 0 ; j < value . length ; j ++ ) {
205205 storeHeader ( this , state , field , value [ j ] ) ;
206206 }
@@ -408,7 +408,7 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
408408 return true ;
409409 }
410410
411- if ( ! util . isString ( chunk ) && ! util . isBuffer ( chunk ) ) {
411+ if ( typeof chunk !== 'string' && ! ( chunk instanceof Buffer ) ) {
412412 throw new TypeError ( 'first argument must be a string or Buffer' ) ;
413413 }
414414
@@ -419,7 +419,7 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
419419
420420 var len , ret ;
421421 if ( this . chunkedEncoding ) {
422- if ( util . isString ( chunk ) &&
422+ if ( typeof chunk === 'string' &&
423423 encoding !== 'hex' &&
424424 encoding !== 'base64' &&
425425 encoding !== 'binary' ) {
@@ -428,7 +428,7 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
428428 ret = this . _send ( chunk , encoding , callback ) ;
429429 } else {
430430 // buffer, or a non-toString-friendly encoding
431- if ( util . isString ( chunk ) )
431+ if ( typeof chunk === 'string' )
432432 len = Buffer . byteLength ( chunk , encoding ) ;
433433 else
434434 len = chunk . length ;
@@ -458,7 +458,7 @@ OutgoingMessage.prototype.write = function(chunk, encoding, callback) {
458458OutgoingMessage . prototype . addTrailers = function ( headers ) {
459459 this . _trailer = '' ;
460460 var keys = Object . keys ( headers ) ;
461- var isArray = util . isArray ( headers ) ;
461+ var isArray = Array . isArray ( headers ) ;
462462 var field , value ;
463463 for ( var i = 0 , l = keys . length ; i < l ; i ++ ) {
464464 var key = keys [ i ] ;
@@ -479,15 +479,15 @@ const crlf_buf = new Buffer('\r\n');
479479
480480
481481OutgoingMessage . prototype . end = function ( data , encoding , callback ) {
482- if ( util . isFunction ( data ) ) {
482+ if ( typeof data === 'function' ) {
483483 callback = data ;
484484 data = null ;
485- } else if ( util . isFunction ( encoding ) ) {
485+ } else if ( typeof encoding === 'function' ) {
486486 callback = encoding ;
487487 encoding = null ;
488488 }
489489
490- if ( data && ! util . isString ( data ) && ! util . isBuffer ( data ) ) {
490+ if ( data && typeof data !== 'string' && ! ( data instanceof Buffer ) ) {
491491 throw new TypeError ( 'first argument must be a string or Buffer' ) ;
492492 }
493493
@@ -500,10 +500,9 @@ OutgoingMessage.prototype.end = function(data, encoding, callback) {
500500 self . emit ( 'finish' ) ;
501501 }
502502
503- if ( util . isFunction ( callback ) )
503+ if ( typeof callback === 'function' )
504504 this . once ( 'finish' , callback ) ;
505505
506-
507506 if ( ! this . _header ) {
508507 this . _implicitHeader ( ) ;
509508 }
0 commit comments