Skip to content

Commit 67357cb

Browse files
committed
Fix code style: arrow-parens
1 parent ff627a0 commit 67357cb

File tree

6 files changed

+13
-13
lines changed

6 files changed

+13
-13
lines changed

child-process/master.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ for (let i = 0; i < cpuCount; i++) {
1717
const task = [2, 17, 3, 2, 5, 7, 15, 22, 1, 14, 15, 9, 0, 11];
1818
const results = [];
1919

20-
workers.forEach(worker => {
20+
workers.forEach((worker) => {
2121

2222
worker.send({ task });
2323

24-
worker.on('exit', code => {
24+
worker.on('exit', (code) => {
2525
console.log('Worker exited:', worker.pid, code);
2626
});
2727

28-
worker.on('message', message => {
28+
worker.on('message', (message) => {
2929

3030
console.log('Message from worker', worker.pid);
3131
console.log(message);

child-process/worker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
console.log('Hello from worker', process.pid);
44

5-
const caltulations = item => item * 2;
5+
const caltulations = (item) => item * 2;
66

7-
process.on('message', message => {
7+
process.on('message', (message) => {
88
console.log('Message to worker', process.pid);
99
console.log('from master:', message);
1010

cluster/master.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ for (let i = 0; i < cpuCount; i++) {
1717
const task = [2, 17, 3, 2, 5, 7, 15, 22, 1, 14, 15, 9, 0, 11];
1818
const results = [];
1919

20-
workers.forEach(worker => {
20+
workers.forEach((worker) => {
2121

2222
worker.send({ task });
2323

24-
worker.on('exit', code => {
24+
worker.on('exit', (code) => {
2525
console.log('Worker exited:', worker.process.pid, code);
2626
});
2727

28-
worker.on('message', message => {
28+
worker.on('message', (message) => {
2929

3030
console.log('Message from worker', worker.process.pid);
3131
console.log(message);

cluster/worker.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ const cluster = require('node:cluster');
44

55
console.log('Hello from worker', process.pid, cluster.worker.id);
66

7-
const caltulations = x => x * 2;
7+
const caltulations = (x) => x * 2;
88

9-
process.on('message', message => {
9+
process.on('message', (message) => {
1010

1111
console.log('Message to worker ', process.pid);
1212
console.log(message);

tcp/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ socket.connect({
99
host: '127.0.0.1',
1010
}, () => {
1111
socket.write('Hello from client');
12-
socket.on('data', data => {
12+
socket.on('data', (data) => {
1313
const message = data.toString();
1414
const user = JSON.parse(message);
1515
console.log('Data received (by client):', data);

tcp/server.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ const net = require('npde:net');
44

55
const user = { name: 'Marcus Aurelius', age: 1895 };
66

7-
const server = net.createServer(socket => {
7+
const server = net.createServer((socket) => {
88
console.log('Connected:', socket.localAddress);
99
socket.write(JSON.stringify(user));
10-
socket.on('data', data => {
10+
socket.on('data', (data) => {
1111
const message = data.toString();
1212
console.log('Data received (by server):', data);
1313
console.log('toString:', message);

0 commit comments

Comments
 (0)