Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: convert to arrow function #24623

Closed
wants to merge 2 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,25 @@ const handleConversion = {
'net.Native': {
simultaneousAccepts: true,

send: function(message, handle, options) {
send: (message, handle, options) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd think changing this pattern to something like

send(message, handle, options) {

would be even better?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @joyeecheung
I will review my changes according to your suggestion.

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);
});
}
Expand Down Expand Up @@ -141,7 +141,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 Down Expand Up @@ -183,28 +183,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 @@ -617,7 +617,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 @@ -739,7 +739,7 @@ function setupChannel(target, channel) {
}

if (wasAsyncWrite) {
req.oncomplete = function() {
req.oncomplete = () => {
control.unref();
if (typeof callback === 'function')
callback(null);
Expand Down Expand Up @@ -876,7 +876,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