Skip to content

Commit 4b267df

Browse files
ronkorvingsilverwind
ronkorving
authored andcommitted
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: #4301 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Brian White <[email protected]> Reviewed-By: Roman Reiss <[email protected]>
1 parent f176b31 commit 4b267df

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/dgram.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ Socket.prototype.send = function(buffer,
252252

253253
if (typeof buffer === 'string')
254254
buffer = new Buffer(buffer);
255-
256-
if (!(buffer instanceof Buffer))
255+
else if (!(buffer instanceof Buffer))
257256
throw new TypeError('First argument must be a buffer or string');
258257

259258
offset = offset | 0;

0 commit comments

Comments
 (0)