Skip to content

Commit

Permalink
doc: conform to rules for eslint-plugin-markdown
Browse files Browse the repository at this point in the history
PR-URL: #12563
Refs: #12557 (comment)
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
  • Loading branch information
vsemozhetbyt committed Apr 24, 2017
1 parent b6d293d commit e2c3e47
Show file tree
Hide file tree
Showing 18 changed files with 141 additions and 137 deletions.
30 changes: 15 additions & 15 deletions doc/api/assert.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,18 @@ are evaluated also:
const assert = require('assert');

const obj1 = {
a : {
b : 1
a: {
b: 1
}
};
const obj2 = {
a : {
b : 2
a: {
b: 2
}
};
const obj3 = {
a : {
b : 1
a: {
b: 1
}
};
const obj4 = Object.create(obj1);
Expand Down Expand Up @@ -322,18 +322,18 @@ Tests for any deep inequality. Opposite of [`assert.deepEqual()`][].
const assert = require('assert');

const obj1 = {
a : {
b : 1
a: {
b: 1
}
};
const obj2 = {
a : {
b : 2
a: {
b: 2
}
};
const obj3 = {
a : {
b : 1
a: {
b: 1
}
};
const obj4 = Object.create(obj1);
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 Expand Up @@ -542,7 +542,7 @@ assert.throws(
throw new Error('Wrong value');
},
function(err) {
if ( (err instanceof Error) && /value/.test(err) ) {
if ((err instanceof Error) && /value/.test(err)) {
return true;
}
},
Expand Down
16 changes: 8 additions & 8 deletions doc/api/buffer.md
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ Example: Copy an ASCII string into a `Buffer`, one byte at a time
const str = 'Node.js';
const buf = Buffer.allocUnsafe(str.length);

for (let i = 0; i < str.length ; i++) {
for (let i = 0; i < str.length; i++) {
buf[i] = str.charCodeAt(i);
}

Expand Down Expand Up @@ -1087,7 +1087,7 @@ byte 16 through byte 19 into `buf2`, starting at the 8th byte in `buf2`
const buf1 = Buffer.allocUnsafe(26);
const buf2 = Buffer.allocUnsafe(26).fill('!');

for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}
Expand All @@ -1104,7 +1104,7 @@ overlapping region within the same `Buffer`
```js
const buf = Buffer.allocUnsafe(26);

for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf[i] = i + 97;
}
Expand Down Expand Up @@ -1871,7 +1871,7 @@ one byte from the original `Buffer`
```js
const buf1 = Buffer.allocUnsafe(26);

for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}
Expand Down Expand Up @@ -2021,9 +2021,9 @@ const json = JSON.stringify(buf);
console.log(json);

const copy = JSON.parse(json, (key, value) => {
return value && value.type === 'Buffer'
? Buffer.from(value.data)
: value;
return value && value.type === 'Buffer' ?
Buffer.from(value.data) :
value;
});

// Prints: <Buffer 01 02 03 04 05>
Expand All @@ -2049,7 +2049,7 @@ Examples:
```js
const buf1 = Buffer.allocUnsafe(26);

for (let i = 0 ; i < 26 ; i++) {
for (let i = 0; i < 26; i++) {
// 97 is the decimal ASCII value for 'a'
buf1[i] = i + 97;
}
Expand Down
12 changes: 8 additions & 4 deletions doc/api/child_process.md
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ the process is spawned. The default options are:
const defaults = {
encoding: 'utf8',
timeout: 0,
maxBuffer: 200*1024,
maxBuffer: 200 * 1024,
killSignal: 'SIGTERM',
cwd: null,
env: null
Expand Down Expand Up @@ -933,13 +933,17 @@ as in this example:
'use strict';
const spawn = require('child_process').spawn;

const child = spawn('sh', ['-c',
`node -e "setInterval(() => {
const child = spawn(
'sh',
[
'-c',
`node -e "setInterval(() => {
console.log(process.pid, 'is alive')
}, 500);"`
], {
stdio: ['inherit', 'inherit', 'inherit']
});
}
);

setTimeout(() => {
child.kill(); // does not terminate the node process in the shell
Expand Down
13 changes: 8 additions & 5 deletions doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -523,11 +523,14 @@ When any of the workers die the cluster module will emit the `'exit'` event.
This can be used to restart the worker by calling `.fork()` again.

```js
cluster.on('exit', (worker, code, signal) => {
console.log('worker %d died (%s). restarting...',
worker.process.pid, signal || code);
cluster.fork();
});
cluster.on(
'exit',
(worker, code, signal) => {
console.log('worker %d died (%s). restarting...',
worker.process.pid, signal || code);
cluster.fork();
}
);
```

See [child_process event: 'exit'][].
Expand Down
6 changes: 2 additions & 4 deletions doc/api/console.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ the default behavior of `console` in Node.js.
// new impl for assert without monkey-patching.
const myConsole = Object.create(console, {
assert: {
value: function assert(assertion, message, ...args) {
value(assertion, message, ...args) {
try {
console.assert(assertion, message, ...args);
} catch (err) {
Expand Down Expand Up @@ -276,9 +276,7 @@ prints the result to `stdout`:

```js
console.time('100-elements');
for (let i = 0; i < 100; i++) {
;
}
for (let i = 0; i < 100; i++) ;
console.timeEnd('100-elements');
// prints 100-elements: 225.438ms
```
Expand Down
6 changes: 4 additions & 2 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ decipher.on('end', () => {
// Prints: some clear text data
});

const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
const encrypted =
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
decipher.write(encrypted, 'hex');
decipher.end();
```
Expand All @@ -312,7 +313,8 @@ Example: Using the [`decipher.update()`][] and [`decipher.final()`][] methods:
const crypto = require('crypto');
const decipher = crypto.createDecipher('aes192', 'a password');

const encrypted = 'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
const encrypted =
'ca981be48e90867604588e75d04feabb63cc007a8f8ad89b10616ed84d815504';
let decrypted = decipher.update(encrypted, 'hex', 'utf8');
decrypted += decipher.final('utf8');
console.log(decrypted);
Expand Down
2 changes: 1 addition & 1 deletion doc/api/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ function handleRequest(req, res) {
setTimeout(() => {
// Whoops!
flerb.bark();
});
}, timeout);
break;
default:
res.end('ok');
Expand Down
8 changes: 4 additions & 4 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ const net = require('net');
const url = require('url');

// Create an HTTP tunneling proxy
const proxy = http.createServer( (req, res) => {
const proxy = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
Expand Down Expand Up @@ -405,7 +405,7 @@ A client server pair demonstrating how to listen for the `'upgrade'` event.
const http = require('http');

// Create an HTTP server
const srv = http.createServer( (req, res) => {
const srv = http.createServer((req, res) => {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('okay');
});
Expand Down Expand Up @@ -1570,10 +1570,10 @@ http.get('http://nodejs.org/dist/index.json', (res) => {

let error;
if (statusCode !== 200) {
error = new Error(`Request Failed.\n` +
error = new Error('Request Failed.\n' +
`Status Code: ${statusCode}`);
} else if (!/^application\/json/.test(contentType)) {
error = new Error(`Invalid content-type.\n` +
error = new Error('Invalid content-type.\n' +
`Expected application/json but received ${contentType}`);
}
if (error) {
Expand Down
4 changes: 2 additions & 2 deletions doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ When a file is run directly from Node.js, `require.main` is set to its
directly by testing

```js
require.main === module
require.main === module;
```

For a file `foo.js`, this will be `true` if run via `node foo.js`, but
Expand Down Expand Up @@ -441,7 +441,7 @@ Before a module's code is executed, Node.js will wrap it with a function
wrapper that looks like the following:

```js
(function (exports, require, module, __filename, __dirname) {
(function(exports, require, module, __filename, __dirname) {
// Your module code actually lives in here
});
```
Expand Down
Loading

0 comments on commit e2c3e47

Please sign in to comment.