Skip to content

Commit

Permalink
doc: unify spaces in object literals
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
vsemozhetbyt authored and jasnell committed Jun 5, 2017
1 parent 4e68760 commit 6cd5312
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 23 deletions.
10 changes: 5 additions & 5 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 } }
```

Expand Down Expand Up @@ -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
```

Expand Down
4 changes: 2 additions & 2 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...>
Expand Down Expand Up @@ -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.
Expand Down
10 changes: 5 additions & 5 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down Expand Up @@ -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) => {
Expand Down Expand Up @@ -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();
```

Expand Down Expand Up @@ -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');
});
```
Expand Down Expand Up @@ -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');
});
```
Expand Down
4 changes: 3 additions & 1 deletion doc/api/inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -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' ]
```

Expand Down
4 changes: 2 additions & 2 deletions doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
8 changes: 4 additions & 4 deletions doc/api/repl.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6cd5312

Please sign in to comment.