diff options
Diffstat (limited to 'lib/dgram.js')
-rw-r--r-- | lib/dgram.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/lib/dgram.js b/lib/dgram.js index 3ea0665e6..7db3f16e0 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -91,7 +91,7 @@ function newHandle(type) { exports._createSocketHandle = function(address, port, addressType, fd) { // Opening an existing fd is not supported for UDP handles. - assert(!IS_NUMBER(fd) || fd < 0); + assert(!util.isNumber(fd) || fd < 0); var handle = newHandle(addressType); @@ -119,7 +119,7 @@ function Socket(type, listener) { this.type = type; this.fd = null; // compatibility hack - if (IS_FUNCTION(listener)) + if (util.isFunction(listener)) this.on('message', listener); } util.inherits(Socket, events.EventEmitter); @@ -165,7 +165,7 @@ Socket.prototype.bind = function(/*port, address, callback*/) { this._bindState = BIND_STATE_BINDING; - if (IS_FUNCTION(arguments[arguments.length - 1])) + if (util.isFunction(arguments[arguments.length - 1])) self.once('listening', arguments[arguments.length - 1]); var UDP = process.binding('udp_wrap').UDP; @@ -177,7 +177,7 @@ Socket.prototype.bind = function(/*port, address, callback*/) { var port = arguments[0]; var address = arguments[1]; - if (IS_FUNCTION(address)) address = ''; // a.k.a. "any address" + if (util.isFunction(address)) address = ''; // a.k.a. "any address" // resolve address first self._handle.lookup(address, function(err, ip) { @@ -231,10 +231,10 @@ Socket.prototype.sendto = function(buffer, port, address, callback) { - if (!IS_NUMBER(offset) || !IS_NUMBER(length)) + if (!util.isNumber(offset) || !util.isNumber(length)) throw new Error('send takes offset and length as args 2 and 3'); - if (!IS_STRING(address)) + if (!util.isString(address)) throw new Error(this.type + ' sockets must send to port, address'); this.send(buffer, offset, length, port, address, callback); @@ -249,7 +249,7 @@ Socket.prototype.send = function(buffer, callback) { var self = this; - if (!IS_BUFFER(buffer)) + if (!util.isBuffer(buffer)) throw new TypeError('First argument must be a buffer object.'); if (offset >= buffer.length) @@ -339,7 +339,7 @@ Socket.prototype.setBroadcast = function(arg) { Socket.prototype.setTTL = function(arg) { - if (!IS_NUMBER(arg)) { + if (!util.isNumber(arg)) { throw new TypeError('Argument must be a number'); } @@ -353,7 +353,7 @@ Socket.prototype.setTTL = function(arg) { Socket.prototype.setMulticastTTL = function(arg) { - if (!IS_NUMBER(arg)) { + if (!util.isNumber(arg)) { throw new TypeError('Argument must be a number'); } |