Skip to content

Commit 2fcefee

Browse files
claudiorodriguezitaloacasas
authored andcommitted
dgram: refactor dgram to module.exports
Refactor dgram module to use the more efficient module.exports = {} pattern. PR-URL: #11696 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Franziska Hinkelmann <[email protected]> Reviewed-By: Ron Korving <[email protected]>
1 parent 8a1b2b4 commit 2fcefee

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/dgram.js

+10-5
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function newHandle(type) {
5757
}
5858

5959

60-
exports._createSocketHandle = function(address, port, addressType, fd, flags) {
60+
function _createSocketHandle(address, port, addressType, fd, flags) {
6161
// Opening an existing fd is not supported for UDP handles.
6262
assert(typeof fd !== 'number' || fd < 0);
6363

@@ -72,7 +72,7 @@ exports._createSocketHandle = function(address, port, addressType, fd, flags) {
7272
}
7373

7474
return handle;
75-
};
75+
}
7676

7777

7878
function Socket(type, listener) {
@@ -99,12 +99,11 @@ function Socket(type, listener) {
9999
this.on('message', listener);
100100
}
101101
util.inherits(Socket, EventEmitter);
102-
exports.Socket = Socket;
103102

104103

105-
exports.createSocket = function(type, listener) {
104+
function createSocket(type, listener) {
106105
return new Socket(type, listener);
107-
};
106+
}
108107

109108

110109
function startListening(socket) {
@@ -561,3 +560,9 @@ Socket.prototype.unref = function() {
561560

562561
return this;
563562
};
563+
564+
module.exports = {
565+
_createSocketHandle,
566+
createSocket,
567+
Socket
568+
};

0 commit comments

Comments
 (0)