Skip to content

Commit 6cd5312

Browse files
vsemozhetbytjasnell
authored andcommitted
doc: unify spaces in object literals
PR-URL: #13354 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Gibson Fahnestock <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Michael Dawson <[email protected]> Reviewed-By: Tobias Nießen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 4e68760 commit 6cd5312

9 files changed

+25
-23
lines changed

doc/api/assert.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ Generally identical to `assert.deepEqual()` with three exceptions:
131131
```js
132132
const assert = require('assert');
133133

134-
assert.deepEqual({a: 1}, {a: '1'});
134+
assert.deepEqual({ a: 1 }, { a: '1' });
135135
// OK, because 1 == '1'
136136

137-
assert.deepStrictEqual({a: 1}, {a: '1'});
137+
assert.deepStrictEqual({ a: 1 }, { a: '1' });
138138
// AssertionError: { a: 1 } deepStrictEqual { a: '1' }
139139
// because 1 !== '1' using strict equality
140140

@@ -248,7 +248,7 @@ assert.equal(1, '1');
248248

249249
assert.equal(1, 2);
250250
// AssertionError: 1 == 2
251-
assert.equal({a: {b: 1}}, {a: {b: 1}});
251+
assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
252252
//AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
253253
```
254254

@@ -368,10 +368,10 @@ Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][].
368368
```js
369369
const assert = require('assert');
370370

371-
assert.notDeepEqual({a: 1}, {a: '1'});
371+
assert.notDeepEqual({ a: 1 }, { a: '1' });
372372
// AssertionError: { a: 1 } notDeepEqual { a: '1' }
373373

374-
assert.notDeepStrictEqual({a: 1}, {a: '1'});
374+
assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
375375
// OK
376376
```
377377

doc/api/child_process.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ const util = require('util');
224224
const exec = util.promisify(require('child_process').exec);
225225

226226
async function lsExample() {
227-
const {stdout, stderr} = await exec('ls');
227+
const { stdout, stderr } = await exec('ls');
228228
console.log('stdout:', stdout);
229229
console.log('stderr:', stderr);
230230
}
@@ -287,7 +287,7 @@ a Promise for an object with `stdout` and `stderr` properties.
287287
const util = require('util');
288288
const execFile = util.promisify(require('child_process').execFile);
289289
async function getVersion() {
290-
const {stdout} = await execFile('node', ['--version']);
290+
const { stdout } = await execFile('node', ['--version']);
291291
console.log(stdout);
292292
}
293293
getVersion();

doc/api/fs.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ support. If `filename` is provided, it will be provided as a `Buffer` if
228228

229229
```js
230230
// Example when handled through fs.watch listener
231-
fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {
231+
fs.watch('./tmp', { encoding: 'buffer' }, (eventType, filename) => {
232232
if (filename)
233233
console.log(filename);
234234
// Prints: <Buffer ...>
@@ -787,7 +787,7 @@ file was created.
787787
An example to read the last 10 bytes of a file which is 100 bytes long:
788788

789789
```js
790-
fs.createReadStream('sample.txt', {start: 90, end: 99});
790+
fs.createReadStream('sample.txt', { start: 90, end: 99 });
791791
```
792792

793793
If `options` is a string, then it specifies the encoding.

doc/api/http.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ const url = require('url');
312312

313313
// Create an HTTP tunneling proxy
314314
const proxy = http.createServer((req, res) => {
315-
res.writeHead(200, {'Content-Type': 'text/plain'});
315+
res.writeHead(200, { 'Content-Type': 'text/plain' });
316316
res.end('okay');
317317
});
318318
proxy.on('connect', (req, cltSocket, head) => {
@@ -408,7 +408,7 @@ const http = require('http');
408408

409409
// Create an HTTP server
410410
const srv = http.createServer((req, res) => {
411-
res.writeHead(200, {'Content-Type': 'text/plain'});
411+
res.writeHead(200, { 'Content-Type': 'text/plain' });
412412
res.end('okay');
413413
});
414414
srv.on('upgrade', (req, socket, head) => {
@@ -912,7 +912,7 @@ emit trailers, with a list of the header fields in its value. E.g.,
912912
response.writeHead(200, { 'Content-Type': 'text/plain',
913913
'Trailer': 'Content-MD5' });
914914
response.write(fileData);
915-
response.addTrailers({'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667'});
915+
response.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
916916
response.end();
917917
```
918918

@@ -1103,7 +1103,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to
11031103
const server = http.createServer((req, res) => {
11041104
res.setHeader('Content-Type', 'text/html');
11051105
res.setHeader('X-Foo', 'bar');
1106-
res.writeHead(200, {'Content-Type': 'text/plain'});
1106+
res.writeHead(200, { 'Content-Type': 'text/plain' });
11071107
res.end('ok');
11081108
});
11091109
```
@@ -1257,7 +1257,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to
12571257
const server = http.createServer((req, res) => {
12581258
res.setHeader('Content-Type', 'text/html');
12591259
res.setHeader('X-Foo', 'bar');
1260-
res.writeHead(200, {'Content-Type': 'text/plain'});
1260+
res.writeHead(200, { 'Content-Type': 'text/plain' });
12611261
res.end('ok');
12621262
});
12631263
```

doc/api/inspector.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ event, and prints the reason for program suspension whenever program
5858
execution is suspended (through breakpoints, for example):
5959

6060
```js
61-
session.on('Debugger.paused', ({params}) => console.log(params.hitBreakpoints));
61+
session.on('Debugger.paused', ({ params }) => {
62+
console.log(params.hitBreakpoints);
63+
});
6264
// [ '/node/test/inspector/test-bindings.js:11:0' ]
6365
```
6466

doc/api/net.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,7 @@ in the [`net.createServer()`][] section:
884884

885885
```js
886886
const net = require('net');
887-
const client = net.createConnection({port: 8124}, () => {
887+
const client = net.createConnection({ port: 8124 }, () => {
888888
//'connect' listener
889889
console.log('connected to server!');
890890
client.write('world!\r\n');
@@ -902,7 +902,7 @@ To connect on the socket `/tmp/echo.sock` the second line would just be
902902
changed to
903903

904904
```js
905-
const client = net.createConnection({path: '/tmp/echo.sock'});
905+
const client = net.createConnection({ path: '/tmp/echo.sock' });
906906
```
907907

908908
### net.createConnection(path[, connectListener])

doc/api/readline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ For example:
310310
```js
311311
rl.write('Delete this!');
312312
// Simulate Ctrl+u to delete the line written previously
313-
rl.write(null, {ctrl: true, name: 'u'});
313+
rl.write(null, { ctrl: true, name: 'u' });
314314
```
315315

316316
*Note*: The `rl.write()` method will write the data to the `readline`

doc/api/repl.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ function myEval(cmd, context, filename, callback) {
180180
callback(null, myTranslator.translate(cmd));
181181
}
182182

183-
repl.start({prompt: '> ', eval: myEval});
183+
repl.start({ prompt: '> ', eval: myEval });
184184
```
185185

186186
#### Recoverable Errors
@@ -226,7 +226,7 @@ following example, for instance, simply converts any input text to upper case:
226226
```js
227227
const repl = require('repl');
228228

229-
const r = repl.start({prompt: '> ', eval: myEval, writer: myWriter});
229+
const r = repl.start({ prompt: '> ', eval: myEval, writer: myWriter });
230230

231231
function myEval(cmd, context, filename, callback) {
232232
callback(null, cmd);
@@ -284,7 +284,7 @@ function initializeContext(context) {
284284
context.m = 'test';
285285
}
286286

287-
const r = repl.start({prompt: '> '});
287+
const r = repl.start({ prompt: '> ' });
288288
initializeContext(r.context);
289289

290290
r.on('reset', initializeContext);
@@ -331,7 +331,7 @@ The following example shows two new commands added to the REPL instance:
331331
```js
332332
const repl = require('repl');
333333

334-
const replServer = repl.start({prompt: '> '});
334+
const replServer = repl.start({ prompt: '> ' });
335335
replServer.defineCommand('sayhello', {
336336
help: 'Say hello',
337337
action(name) {

doc/guides/writing-tests.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall((req, res) => { // 10
3838
server.listen(0, () => { // 13
3939
http.get({ // 14
4040
port: server.address().port, // 15
41-
headers: {'Test': 'Düsseldorf'} // 16
41+
headers: { 'Test': 'Düsseldorf' } // 16
4242
}, common.mustCall((res) => { // 17
4343
assert.strictEqual(res.statusCode, 200); // 18
4444
server.close(); // 19

0 commit comments

Comments
 (0)