Skip to content

Commit a3cd733

Browse files
TrottMylesBorins
authored andcommitted
doc: fix indentation issues in sample code
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]>
1 parent b7b38bd commit a3cd733

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

doc/api/crypto.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ const aliceSecret = alice.computeSecret(bobKey);
544544
const bobSecret = bob.computeSecret(aliceKey);
545545

546546
assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex'));
547-
// OK
547+
// OK
548548
```
549549

550550
### ecdh.computeSecret(other_public_key[, input_encoding][, output_encoding])
@@ -684,10 +684,11 @@ const hash = crypto.createHash('sha256');
684684

685685
hash.on('readable', () => {
686686
const data = hash.read();
687-
if (data)
687+
if (data) {
688688
console.log(data.toString('hex'));
689689
// Prints:
690690
// 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50
691+
}
691692
});
692693

693694
hash.write('some data to hash');
@@ -767,10 +768,11 @@ const hmac = crypto.createHmac('sha256', 'a secret');
767768

768769
hmac.on('readable', () => {
769770
const data = hmac.read();
770-
if (data)
771+
if (data) {
771772
console.log(data.toString('hex'));
772773
// Prints:
773774
// 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e
775+
}
774776
});
775777

776778
hmac.write('some data to hash');

doc/api/querystring.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ in the following example:
7171
// Assuming gbkDecodeURIComponent function already exists...
7272

7373
querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
74-
{ decodeURIComponent: gbkDecodeURIComponent });
74+
{ decodeURIComponent: gbkDecodeURIComponent });
7575
```
7676

7777
## querystring.stringify(obj[, sep[, eq[, options]]])
@@ -115,7 +115,7 @@ following example:
115115
// Assuming gbkEncodeURIComponent function already exists,
116116

117117
querystring.stringify({ w: '中文', foo: 'bar' }, null, null,
118-
{ encodeURIComponent: gbkEncodeURIComponent });
118+
{ encodeURIComponent: gbkEncodeURIComponent });
119119
```
120120

121121
## querystring.unescape(str)

doc/guides/writing-tests.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ Let's analyze this basic test from the Node.js test suite:
2525
```javascript
2626
'use strict'; // 1
2727
const common = require('../common'); // 2
28-
// 3
28+
2929
// This test ensures that the http-parser can handle UTF-8 characters // 4
3030
// in the http header. // 5
31-
// 6
31+
3232
const assert = require('assert'); // 7
3333
const http = require('http'); // 8
34-
// 9
34+
3535
const server = http.createServer(common.mustCall((req, res) => { // 10
3636
res.end('ok'); // 11
3737
})); // 12

0 commit comments

Comments
 (0)