mirror of
https://github.com/nodejs/node.git
synced 2026-11-30 11:55:44 -05:00
udp: remove a needless instanceof Buffer check
When a string is passed to udpsock.send, it is automatically converted to a Buffer. In that case, it is no longer needed to test whether or not the argument is a Buffer or not. PR-URL: https://github.com/nodejs/node/pull/4301 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Roman Reiss <me@silverwind.io>
This commit is contained in:
1 parent
764df2166e
commit
dd0c925896
1 file changed
+1
-2
+1
-2
@@ -252,8 +252,7 @@ Socket.prototype.send = function(buffer,
|
||||
|
||||
if (typeof buffer === 'string')
|
||||
buffer = new Buffer(buffer);
|
||||
|
||||
if (!(buffer instanceof Buffer))
|
||||
else if (!(buffer instanceof Buffer))
|
||||
throw new TypeError('First argument must be a buffer or string.');
|
||||
|
||||
offset = offset | 0;
|
||||
|
||||
Reference in new issue
Block a user