Skip to content

Commit

Permalink
lib: convert to arrow function
Browse files Browse the repository at this point in the history
PR-URL: #24623
Reviewed-By: Shingo Inoue <leko.noor@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
  • Loading branch information
horihiro authored and BethGriggs committed Feb 12, 2019
1 parent be17cc5 commit 8f427eb
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,32 +62,32 @@ const handleConversion = {
'net.Native': {
simultaneousAccepts: true,

send: function(message, handle, options) {
send(message, handle, options) {
return handle;
},

got: function(message, handle, emit) {
got(message, handle, emit) {
emit(handle);
}
},

'net.Server': {
simultaneousAccepts: true,

send: function(message, server, options) {
send(message, server, options) {
return server._handle;
},

got: function(message, handle, emit) {
got(message, handle, emit) {
var server = new net.Server();
server.listen(handle, function() {
server.listen(handle, () => {
emit(server);
});
}
},

'net.Socket': {
send: function(message, socket, options) {
send(message, socket, options) {
if (!socket._handle)
return;

Expand Down Expand Up @@ -135,7 +135,7 @@ const handleConversion = {
return handle;
},

postSend: function(message, handle, options, callback, target) {
postSend(message, handle, options, callback, target) {
// Store the handle after successfully sending it, so it can be closed
// when the NODE_HANDLE_ACK is received. If the handle could not be sent,
// just close it.
Expand All @@ -153,7 +153,7 @@ const handleConversion = {
}
},

got: function(message, handle, emit) {
got(message, handle, emit) {
var socket = new net.Socket({
handle: handle,
readable: true,
Expand All @@ -177,28 +177,28 @@ const handleConversion = {
'dgram.Native': {
simultaneousAccepts: false,

send: function(message, handle, options) {
send(message, handle, options) {
return handle;
},

got: function(message, handle, emit) {
got(message, handle, emit) {
emit(handle);
}
},

'dgram.Socket': {
simultaneousAccepts: false,

send: function(message, socket, options) {
send(message, socket, options) {
message.dgramType = socket.type;

return socket[kStateSymbol].handle;
},

got: function(message, handle, emit) {
got(message, handle, emit) {
var socket = new dgram.Socket(message.dgramType);

socket.bind(handle, function() {
socket.bind(handle, () => {
emit(socket);
});
}
Expand Down Expand Up @@ -610,7 +610,7 @@ function setupChannel(target, channel) {
}

// Convert handle object
obj.got.call(this, message, handle, function(handle) {
obj.got.call(this, message, handle, (handle) => {
handleMessage(message.msg, handle, isInternal(message.msg));
});
});
Expand Down Expand Up @@ -732,7 +732,7 @@ function setupChannel(target, channel) {
}

if (req.async) {
req.oncomplete = function() {
req.oncomplete = () => {
control.unref();
if (typeof callback === 'function')
callback(null);
Expand Down Expand Up @@ -869,7 +869,7 @@ function _validateStdio(stdio, sync) {

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

0 comments on commit 8f427eb

Please sign in to comment.