diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js index 02481739250635..f5f05486d233a9 100644 --- a/lib/_stream_writable.js +++ b/lib/_stream_writable.js @@ -249,9 +249,7 @@ function validChunk(stream, state, chunk, cb) { if (chunk === null) { er = new errors.TypeError('ERR_STREAM_NULL_VALUES'); - } else if (typeof chunk !== 'string' && - chunk !== undefined && - !state.objectMode) { + } else if (typeof chunk !== 'string' && !state.objectMode) { er = new errors.TypeError('ERR_INVALID_ARG_TYPE', 'chunk', ['string', 'Buffer']); } diff --git a/lib/net.js b/lib/net.js index f962a848fad662..5562db6ed61e38 100644 --- a/lib/net.js +++ b/lib/net.js @@ -701,17 +701,6 @@ protoGetter('localPort', function localPort() { }); -Socket.prototype.write = function(chunk, encoding, cb) { - if (typeof chunk !== 'string' && !(chunk instanceof Buffer)) { - throw new errors.TypeError('ERR_INVALID_ARG_TYPE', - 'chunk', - ['string', 'Buffer'], - chunk); - } - return stream.Duplex.prototype.write.apply(this, arguments); -}; - - Socket.prototype._writeGeneric = function(writev, data, encoding, cb) { // If we are still connecting, then buffer this for later. // The Writable logic will buffer up any more writes while