From c3810e27bd33d05d862c0c711c216486f8e503d7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 13 Dec 2017 07:39:29 +0100 Subject: [PATCH] net: remove Socket.prototype.write This is superfluous now that typechecking in `net` and `stream` are aligned. PR-URL: https://github.com/nodejs/node/pull/17644 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anatoli Papirovski Reviewed-By: James M Snell Reviewed-By: Jon Moss --- lib/net.js | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/lib/net.js b/lib/net.js index 4f2b487410fb10..2d1445bcac6ed8 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