Skip to content

doc: unify trailing commas in code examples #12557

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
24 changes: 12 additions & 12 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,18 @@ const assert = require('assert');

const obj1 = {
a : {
b : 1
}
b : 1,
},
};
const obj2 = {
a : {
b : 2
}
b : 2,
},
};
const obj3 = {
a : {
b : 1
}
b : 1,
},
};
const obj4 = Object.create(obj1);

Expand Down Expand Up @@ -323,18 +323,18 @@ const assert = require('assert');

const obj1 = {
a : {
b : 1
}
b : 1,
},
};
const obj2 = {
a : {
b : 2
}
b : 2,
},
};
const obj3 = {
a : {
b : 1
}
b : 1,
},
};
const obj4 = Object.create(obj1);

Expand Down
16 changes: 8 additions & 8 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ the process is spawned. The default options are:
maxBuffer: 200*1024,
killSignal: 'SIGTERM',
cwd: null,
env: null
env: null,
}
```

Expand Down Expand Up @@ -364,7 +364,7 @@ A third argument may be used to specify additional options, with these defaults:
```js
{
cwd: undefined,
env: process.env
env: process.env,
}
```

Expand Down Expand Up @@ -487,7 +487,7 @@ const spawn = require('child_process').spawn;

const child = spawn(process.argv[0], ['child_program.js'], {
detached: true,
stdio: 'ignore'
stdio: 'ignore',
});

child.unref();
Expand All @@ -503,7 +503,7 @@ const err = fs.openSync('./out.log', 'a');

const child = spawn('prg', [], {
detached: true,
stdio: [ 'ignore', out, err ]
stdio: [ 'ignore', out, err ],
});

child.unref();
Expand Down Expand Up @@ -934,9 +934,9 @@ const spawn = require('child_process').spawn;
const child = spawn('sh', ['-c',
`node -e "setInterval(() => {
console.log(process.pid, 'is alive')
}, 500);"`
}, 500);"`,
], {
stdio: ['inherit', 'inherit', 'inherit']
stdio: ['inherit', 'inherit', 'inherit'],
});

setTimeout(() => {
Expand Down Expand Up @@ -1192,8 +1192,8 @@ const child = child_process.spawn('ls', {
stdio: [
0, // Use parent's stdin for child
'pipe', // Pipe child's stdout to parent
fs.openSync('err.out', 'w') // Direct child's stderr to a file
]
fs.openSync('err.out', 'w'), // Direct child's stderr to a file
],
});

assert.strictEqual(child.stdio[0], null);
Expand Down
4 changes: 2 additions & 2 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -789,12 +789,12 @@ const cluster = require('cluster');
cluster.setupMaster({
exec: 'worker.js',
args: ['--use', 'https'],
silent: true
silent: true,
});
cluster.fork(); // https worker
cluster.setupMaster({
exec: 'worker.js',
args: ['--use', 'http']
args: ['--use', 'http'],
});
cluster.fork(); // http worker
```
Expand Down
2 changes: 1 addition & 1 deletion doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ An example socket listening on an exclusive port is shown below.
socket.bind({
address: 'localhost',
port: 8000,
exclusive: true
exclusive: true,
});
```

Expand Down
6 changes: 3 additions & 3 deletions doc/api/dns.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ For example:
regexp: '',
replacement: '_sip._udp.example.com',
order: 30,
preference: 100
preference: 100,
}
```

Expand Down Expand Up @@ -360,7 +360,7 @@ be an object with the following properties:
refresh: 10000,
retry: 2400,
expire: 604800,
minttl: 3600
minttl: 3600,
}
```

Expand All @@ -387,7 +387,7 @@ be an array of objects with the following properties:
priority: 10,
weight: 5,
port: 21223,
name: 'service.example.com'
name: 'service.example.com',
}
```

Expand Down
4 changes: 2 additions & 2 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -635,7 +635,7 @@ default value of 64 kb for the same parameter.
encoding: null,
fd: null,
mode: 0o666,
autoClose: true
autoClose: true,
}
```

Expand Down Expand Up @@ -701,7 +701,7 @@ Returns a new [`WriteStream`][] object. (See [Writable Stream][]).
defaultEncoding: 'utf8',
fd: null,
mode: 0o666,
autoClose: true
autoClose: true,
}
```

Expand Down
14 changes: 7 additions & 7 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ http.get({
hostname: 'localhost',
port: 80,
path: '/',
agent: false // create a new agent just for this one request
agent: false, // create a new agent just for this one request
}, (res) => {
// Do stuff with response
});
Expand Down Expand Up @@ -334,7 +334,7 @@ proxy.listen(1337, '127.0.0.1', () => {
port: 1337,
hostname: '127.0.0.1',
method: 'CONNECT',
path: 'www.google.com:80'
path: 'www.google.com:80',
};

const req = http.request(options);
Expand Down Expand Up @@ -427,8 +427,8 @@ srv.listen(1337, '127.0.0.1', () => {
hostname: '127.0.0.1',
headers: {
'Connection': 'Upgrade',
'Upgrade': 'websocket'
}
'Upgrade': 'websocket',
},
};

const req = http.request(options);
Expand Down Expand Up @@ -1667,7 +1667,7 @@ Example:

```js
const postData = querystring.stringify({
'msg': 'Hello World!'
'msg': 'Hello World!',
});

const options = {
Expand All @@ -1677,8 +1677,8 @@ const options = {
method: 'POST',
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Content-Length': Buffer.byteLength(postData)
}
'Content-Length': Buffer.byteLength(postData),
},
};

const req = http.request(options, (res) => {
Expand Down
10 changes: 5 additions & 5 deletions doc/api/https.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const fs = require('fs');

const options = {
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
};

https.createServer(options, (req, res) => {
Expand All @@ -71,7 +71,7 @@ const fs = require('fs');

const options = {
pfx: fs.readFileSync('test/fixtures/test_cert.pfx'),
passphrase: 'sample'
passphrase: 'sample',
};

https.createServer(options, (req, res) => {
Expand Down Expand Up @@ -172,7 +172,7 @@ const options = {
hostname: 'encrypted.google.com',
port: 443,
path: '/',
method: 'GET'
method: 'GET',
};

const req = https.request(options, (res) => {
Expand All @@ -198,7 +198,7 @@ const options = {
path: '/',
method: 'GET',
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem')
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
};
options.agent = new https.Agent(options);

Expand All @@ -219,7 +219,7 @@ const options = {
method: 'GET',
key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'),
agent: false
agent: false,
};

const req = https.request(options, (res) => {
Expand Down
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ The `square` module is defined in `square.js`:
// assigning to exports will not modify module, must use module.exports
module.exports = (width) => {
return {
area: () => width ** 2
area: () => width ** 2,
};
};
```
Expand Down
2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ shown below.
server.listen({
host: 'localhost',
port: 80,
exclusive: true
exclusive: true,
});
```

Expand Down
Loading