summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-06-01 02:07:25 +0300
committerVse Mozhet Byt <vsemozhetbyt@gmail.com>2017-06-03 01:56:19 +0300
commitde411a471e12aac6efcff87bd93a5e5045a70e8f (patch)
treecf111a098f4299883f0730bae89c41a2673f25f0 /doc/api
parent7de6998d899125e9d43de7dae0bb0a0ed9a76d34 (diff)
downloadandroid-node-v8-de411a471e12aac6efcff87bd93a5e5045a70e8f.tar.gz
android-node-v8-de411a471e12aac6efcff87bd93a5e5045a70e8f.tar.bz2
android-node-v8-de411a471e12aac6efcff87bd93a5e5045a70e8f.zip
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>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/assert.md10
-rw-r--r--doc/api/child_process.md4
-rw-r--r--doc/api/fs.md4
-rw-r--r--doc/api/http.md10
-rw-r--r--doc/api/inspector.md4
-rw-r--r--doc/api/net.md4
-rw-r--r--doc/api/readline.md2
-rw-r--r--doc/api/repl.md8
8 files changed, 24 insertions, 22 deletions
diff --git a/doc/api/assert.md b/doc/api/assert.md
index 3eb95f0ba2..1a040a927b 100644
--- a/doc/api/assert.md
+++ b/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
```
diff --git a/doc/api/child_process.md b/doc/api/child_process.md
index 3d73f0b859..2120e36f4b 100644
--- a/doc/api/child_process.md
+++ b/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();
diff --git a/doc/api/fs.md b/doc/api/fs.md
index 9ee328e652..8ae521a0d2 100644
--- a/doc/api/fs.md
+++ b/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.
diff --git a/doc/api/http.md b/doc/api/http.md
index cd66a2063b..2ceeaf6dac 100644
--- a/doc/api/http.md
+++ b/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');
});
```
diff --git a/doc/api/inspector.md b/doc/api/inspector.md
index f90b823b78..73c735efd3 100644
--- a/doc/api/inspector.md
+++ b/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' ]
```
diff --git a/doc/api/net.md b/doc/api/net.md
index 982a5a0aeb..fc0ea4cc12 100644
--- a/doc/api/net.md
+++ b/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])
diff --git a/doc/api/readline.md b/doc/api/readline.md
index 136d0e63ce..bcd68d8085 100644
--- a/doc/api/readline.md
+++ b/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`
diff --git a/doc/api/repl.md b/doc/api/repl.md
index 0e456b71ea..9d6bdfb112 100644
--- a/doc/api/repl.md
+++ b/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) {