Browse Source

doc: unify spaces in object literals

PR-URL: https://github.com/nodejs/node/pull/13354
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Vse Mozhet Byt 8 years ago
parent
commit
de411a471e
  1. 10
      doc/api/assert.md
  2. 4
      doc/api/child_process.md
  3. 4
      doc/api/fs.md
  4. 10
      doc/api/http.md
  5. 4
      doc/api/inspector.md
  6. 4
      doc/api/net.md
  7. 2
      doc/api/readline.md
  8. 8
      doc/api/repl.md
  9. 2
      doc/guides/writing-tests.md

10
doc/api/assert.md

@ -131,10 +131,10 @@ Generally identical to `assert.deepEqual()` with three exceptions:
```js
const assert = require('assert');
assert.deepEqual({a: 1}, {a: '1'});
assert.deepEqual({ a: 1 }, { a: '1' });
// OK, because 1 == '1'
assert.deepStrictEqual({a: 1}, {a: '1'});
assert.deepStrictEqual({ a: 1 }, { a: '1' });
// AssertionError: { a: 1 } deepStrictEqual { a: '1' }
// because 1 !== '1' using strict equality
@ -248,7 +248,7 @@ assert.equal(1, '1');
assert.equal(1, 2);
// AssertionError: 1 == 2
assert.equal({a: {b: 1}}, {a: {b: 1}});
assert.equal({ a: { b: 1 } }, { a: { b: 1 } });
//AssertionError: { a: { b: 1 } } == { a: { b: 1 } }
```
@ -368,10 +368,10 @@ Tests for deep strict inequality. Opposite of [`assert.deepStrictEqual()`][].
```js
const assert = require('assert');
assert.notDeepEqual({a: 1}, {a: '1'});
assert.notDeepEqual({ a: 1 }, { a: '1' });
// AssertionError: { a: 1 } notDeepEqual { a: '1' }
assert.notDeepStrictEqual({a: 1}, {a: '1'});
assert.notDeepStrictEqual({ a: 1 }, { a: '1' });
// OK
```

4
doc/api/child_process.md

@ -224,7 +224,7 @@ const util = require('util');
const exec = util.promisify(require('child_process').exec);
async function lsExample() {
const {stdout, stderr} = await exec('ls');
const { stdout, stderr } = await exec('ls');
console.log('stdout:', stdout);
console.log('stderr:', stderr);
}
@ -287,7 +287,7 @@ a Promise for an object with `stdout` and `stderr` properties.
const util = require('util');
const execFile = util.promisify(require('child_process').execFile);
async function getVersion() {
const {stdout} = await execFile('node', ['--version']);
const { stdout } = await execFile('node', ['--version']);
console.log(stdout);
}
getVersion();

4
doc/api/fs.md

@ -228,7 +228,7 @@ support. If `filename` is provided, it will be provided as a `Buffer` if
```js
// Example when handled through fs.watch listener
fs.watch('./tmp', {encoding: 'buffer'}, (eventType, filename) => {
fs.watch('./tmp', { encoding: 'buffer' }, (eventType, filename) => {
if (filename)
console.log(filename);
// Prints: <Buffer ...>
@ -787,7 +787,7 @@ file was created.
An example to read the last 10 bytes of a file which is 100 bytes long:
```js
fs.createReadStream('sample.txt', {start: 90, end: 99});
fs.createReadStream('sample.txt', { start: 90, end: 99 });
```
If `options` is a string, then it specifies the encoding.

10
doc/api/http.md

@ -312,7 +312,7 @@ const url = require('url');
// Create an HTTP tunneling proxy
const proxy = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
proxy.on('connect', (req, cltSocket, head) => {
@ -408,7 +408,7 @@ const http = require('http');
// Create an HTTP server
const srv = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('okay');
});
srv.on('upgrade', (req, socket, head) => {
@ -912,7 +912,7 @@ emit trailers, with a list of the header fields in its value. E.g.,
response.writeHead(200, { 'Content-Type': 'text/plain',
'Trailer': 'Content-MD5' });
response.write(fileData);
response.addTrailers({'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667'});
response.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' });
response.end();
```
@ -1103,7 +1103,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to
const server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('ok');
});
```
@ -1257,7 +1257,7 @@ any headers passed to [`response.writeHead()`][], with the headers passed to
const server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
res.writeHead(200, {'Content-Type': 'text/plain'});
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('ok');
});
```

4
doc/api/inspector.md

@ -58,7 +58,9 @@ event, and prints the reason for program suspension whenever program
execution is suspended (through breakpoints, for example):
```js
session.on('Debugger.paused', ({params}) => console.log(params.hitBreakpoints));
session.on('Debugger.paused', ({ params }) => {
console.log(params.hitBreakpoints);
});
// [ '/node/test/inspector/test-bindings.js:11:0' ]
```

4
doc/api/net.md

@ -884,7 +884,7 @@ in the [`net.createServer()`][] section:
```js
const net = require('net');
const client = net.createConnection({port: 8124}, () => {
const client = net.createConnection({ port: 8124 }, () => {
//'connect' listener
console.log('connected to server!');
client.write('world!\r\n');
@ -902,7 +902,7 @@ To connect on the socket `/tmp/echo.sock` the second line would just be
changed to
```js
const client = net.createConnection({path: '/tmp/echo.sock'});
const client = net.createConnection({ path: '/tmp/echo.sock' });
```
### net.createConnection(path[, connectListener])

2
doc/api/readline.md

@ -310,7 +310,7 @@ For example:
```js
rl.write('Delete this!');
// Simulate Ctrl+u to delete the line written previously
rl.write(null, {ctrl: true, name: 'u'});
rl.write(null, { ctrl: true, name: 'u' });
```
*Note*: The `rl.write()` method will write the data to the `readline`

8
doc/api/repl.md

@ -180,7 +180,7 @@ function myEval(cmd, context, filename, callback) {
callback(null, myTranslator.translate(cmd));
}
repl.start({prompt: '> ', eval: myEval});
repl.start({ prompt: '> ', eval: myEval });
```
#### Recoverable Errors
@ -226,7 +226,7 @@ following example, for instance, simply converts any input text to upper case:
```js
const repl = require('repl');
const r = repl.start({prompt: '> ', eval: myEval, writer: myWriter});
const r = repl.start({ prompt: '> ', eval: myEval, writer: myWriter });
function myEval(cmd, context, filename, callback) {
callback(null, cmd);
@ -284,7 +284,7 @@ function initializeContext(context) {
context.m = 'test';
}
const r = repl.start({prompt: '> '});
const r = repl.start({ prompt: '> ' });
initializeContext(r.context);
r.on('reset', initializeContext);
@ -331,7 +331,7 @@ The following example shows two new commands added to the REPL instance:
```js
const repl = require('repl');
const replServer = repl.start({prompt: '> '});
const replServer = repl.start({ prompt: '> ' });
replServer.defineCommand('sayhello', {
help: 'Say hello',
action(name) {

2
doc/guides/writing-tests.md

@ -38,7 +38,7 @@ const server = http.createServer(common.mustCall((req, res) => { // 10
server.listen(0, () => { // 13
http.get({ // 14
port: server.address().port, // 15
headers: {'Test': 'Düsseldorf'} // 16
headers: { 'Test': 'Düsseldorf' } // 16
}, common.mustCall((res) => { // 17
assert.strictEqual(res.statusCode, 200); // 18
server.close(); // 19

Loading…
Cancel
Save