Browse Source

doc: fix indentation issues in sample code

In preparation for stricter ESLint indentation checking, fix a few
issues in sample code.

Backport-PR-URL: https://github.com/nodejs/node/pull/14835
PR-URL: https://github.com/nodejs/node/pull/13950
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
a3cd733dea
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 8
      doc/api/crypto.md
  2. 4
      doc/api/querystring.md
  3. 6
      doc/guides/writing-tests.md

8
doc/api/crypto.md

@ -544,7 +544,7 @@ const aliceSecret = alice.computeSecret(bobKey);
const bobSecret = bob.computeSecret(aliceKey);
assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
// OK
// OK
```
### ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding])
@ -684,10 +684,11 @@ const hash = crypto.createHash('sha256');
hash.on('readable', () => {
const data = hash.read();
if (data)
if (data) {
console.log(data.toString('hex'));
// Prints:
// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
}
});
hash.write('some data to hash');
@ -767,10 +768,11 @@ const hmac = crypto.createHmac('sha256', 'a secret');
hmac.on('readable', () => {
const data = hmac.read();
if (data)
if (data) {
console.log(data.toString('hex'));
// Prints:
// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
}
});
hmac.write('some data to hash');

4
doc/api/querystring.md

@ -71,7 +71,7 @@ in the following example:
// Assuming gbkDecodeURIComponent function already exists...
querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
{ decodeURIComponent: gbkDecodeURIComponent });
{ decodeURIComponent: gbkDecodeURIComponent });
```
## querystring.stringify(obj[, sep[, eq[, options]]])
@ -115,7 +115,7 @@ following example:
// Assuming gbkEncodeURIComponent function already exists,
querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
{ encodeURIComponent: gbkEncodeURIComponent });
{ encodeURIComponent: gbkEncodeURIComponent });
```
## querystring.unescape(str)

6
doc/guides/writing-tests.md

@ -25,13 +25,13 @@ Let's analyze this basic test from the Node.js test suite:
```javascript
'use strict'; // 1
const common = require('../common'); // 2
// 3
// This test ensures that the http-parser can handle UTF-8 characters // 4
// in the http header. // 5
// 6
const assert = require('assert'); // 7
const http = require('http'); // 8
// 9
const server = http.createServer(common.mustCall((req, res) => { // 10
res.end('ok'); // 11
})); // 12

Loading…
Cancel
Save