Skip to content

Commit

Permalink
doc: fix indentation issues in sample code
Browse files Browse the repository at this point in the history
In preparation for stricter ESLint indentation checking, fix a few
issues in sample code.

Backport-PR-URL: #14835
PR-URL: #13950
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Vse Mozhet Byt <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Aug 16, 2017
1 parent b0f8bc9 commit 5f7827d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
8 changes: 5 additions & 3 deletions doc/api/crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions doc/api/querystring.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]]])
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions doc/guides/writing-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5f7827d

Please sign in to comment.