Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
  • Loading branch information
ronkorving committed Dec 16, 2015
commit 30dc5a852747d74f450465ccb099fda28ec55ca2
3 changes: 1 addition & 2 deletions lib/dgram.js
Original file line number Diff line number Diff line change
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