Skip to content

Commit a9e64a8

Browse files
claudiorodriguezfhinkel
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 <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>
1 parent 9ee58c0 commit a9e64a8

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

lib/dgram.js

Lines changed: 10 additions & 5 deletions
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) {
@@ -585,3 +584,9 @@ Socket.prototype.unref = function() {
585584

586585
return this;
587586
};
587+
588+
module.exports = {
589+
_createSocketHandle,
590+
createSocket,
591+
Socket
592+
};

0 commit comments

Comments
 (0)