Skip to content

Commit 6f42b98

Browse files
horihirotargos
authored andcommitted
lib: convert to arrow function
PR-URL: #24623 Reviewed-By: Shingo Inoue <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Masashi Hirano <[email protected]>
1 parent 84249df commit 6f42b98

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

lib/internal/child_process.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -68,32 +68,32 @@ const handleConversion = {
6868
'net.Native': {
6969
simultaneousAccepts: true,
7070

71-
send: function(message, handle, options) {
71+
send(message, handle, options) {
7272
return handle;
7373
},
7474

75-
got: function(message, handle, emit) {
75+
got(message, handle, emit) {
7676
emit(handle);
7777
}
7878
},
7979

8080
'net.Server': {
8181
simultaneousAccepts: true,
8282

83-
send: function(message, server, options) {
83+
send(message, server, options) {
8484
return server._handle;
8585
},
8686

87-
got: function(message, handle, emit) {
87+
got(message, handle, emit) {
8888
var server = new net.Server();
89-
server.listen(handle, function() {
89+
server.listen(handle, () => {
9090
emit(server);
9191
});
9292
}
9393
},
9494

9595
'net.Socket': {
96-
send: function(message, socket, options) {
96+
send(message, socket, options) {
9797
if (!socket._handle)
9898
return;
9999

@@ -141,7 +141,7 @@ const handleConversion = {
141141
return handle;
142142
},
143143

144-
postSend: function(message, handle, options, callback, target) {
144+
postSend(message, handle, options, callback, target) {
145145
// Store the handle after successfully sending it, so it can be closed
146146
// when the NODE_HANDLE_ACK is received. If the handle could not be sent,
147147
// just close it.
@@ -159,7 +159,7 @@ const handleConversion = {
159159
}
160160
},
161161

162-
got: function(message, handle, emit) {
162+
got(message, handle, emit) {
163163
var socket = new net.Socket({
164164
handle: handle,
165165
readable: true,
@@ -183,28 +183,28 @@ const handleConversion = {
183183
'dgram.Native': {
184184
simultaneousAccepts: false,
185185

186-
send: function(message, handle, options) {
186+
send(message, handle, options) {
187187
return handle;
188188
},
189189

190-
got: function(message, handle, emit) {
190+
got(message, handle, emit) {
191191
emit(handle);
192192
}
193193
},
194194

195195
'dgram.Socket': {
196196
simultaneousAccepts: false,
197197

198-
send: function(message, socket, options) {
198+
send(message, socket, options) {
199199
message.dgramType = socket.type;
200200

201201
return socket[kStateSymbol].handle;
202202
},
203203

204-
got: function(message, handle, emit) {
204+
got(message, handle, emit) {
205205
var socket = new dgram.Socket(message.dgramType);
206206

207-
socket.bind(handle, function() {
207+
socket.bind(handle, () => {
208208
emit(socket);
209209
});
210210
}
@@ -618,7 +618,7 @@ function setupChannel(target, channel) {
618618
}
619619

620620
// Convert handle object
621-
obj.got.call(this, message, handle, function(handle) {
621+
obj.got.call(this, message, handle, (handle) => {
622622
handleMessage(message.msg, handle, isInternal(message.msg));
623623
});
624624
});
@@ -740,7 +740,7 @@ function setupChannel(target, channel) {
740740
}
741741

742742
if (wasAsyncWrite) {
743-
req.oncomplete = function() {
743+
req.oncomplete = () => {
744744
control.unref();
745745
if (typeof callback === 'function')
746746
callback(null);
@@ -877,7 +877,7 @@ function _validateStdio(stdio, sync) {
877877

878878
// Translate stdio into C++-readable form
879879
// (i.e. PipeWraps or fds)
880-
stdio = stdio.reduce(function(acc, stdio, i) {
880+
stdio = stdio.reduce((acc, stdio, i) => {
881881
function cleanup() {
882882
for (var i = 0; i < acc.length; i++) {
883883
if ((acc[i].type === 'pipe' || acc[i].type === 'ipc') && acc[i].handle)

0 commit comments

Comments
 (0)