Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Roman Reiss <me@silverwind.io>
  • Loading branch information
ronkorving authored and Myles Borins committed Jan 19, 2016
1 parent 764df21 commit dd0c925
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/dgram.js
Expand Up @@ -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;
Expand Down

0 comments on commit dd0c925

Please sign in to comment.