dgram: refactor dgram to module.exports

Refactor dgram module to use the more efficient
module.exports = {} pattern.

PR-URL: https://github.com/nodejs/node/pull/11696
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Reviewed-By: Ron Korving <ron@ronkorving.nl>
This commit is contained in:
Claudio Rodriguez authored and Italo A. Casas committed 2017-03-13 11:39:51 -04:00
1 parent 8a1b2b4417
commit 2fcefeeda0
1 file changed
+10 -5
+10 -5
View File
@@ -57,7 +57,7 @@ function newHandle(type) {
}
exports._createSocketHandle = function(address, port, addressType, fd, flags) {
function _createSocketHandle(address, port, addressType, fd, flags) {
// Opening an existing fd is not supported for UDP handles.
assert(typeof fd !== 'number' || fd < 0);
@@ -72,7 +72,7 @@ exports._createSocketHandle = function(address, port, addressType, fd, flags) {
}
return handle;
};
}
function Socket(type, listener) {
@@ -99,12 +99,11 @@ function Socket(type, listener) {
this.on('message', listener);
}
util.inherits(Socket, EventEmitter);
exports.Socket = Socket;
exports.createSocket = function(type, listener) {
function createSocket(type, listener) {
return new Socket(type, listener);
};
}
function startListening(socket) {
@@ -561,3 +560,9 @@ Socket.prototype.unref = function() {
return this;
};
module.exports = {
_createSocketHandle,
createSocket,
Socket
};