From d924e546a83a55bd6daabf8c4d910da89c6b2381 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 27 Jun 2017 13:32:32 -0700 Subject: [PATCH] doc: fix indentation issues in sample code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In preparation for stricter ESLint indentation checking, fix a few issues in sample code. PR-URL: https://github.com/nodejs/node/pull/13950 Reviewed-By: Refael Ackermann Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Benjamin Gruenbaum Reviewed-By: Tobias Nießen Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- doc/api/crypto.md | 8 +++++--- doc/api/querystring.md | 4 ++-- doc/guides/writing-tests.md | 6 +++--- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 0af112727b3f65..a40178db22e6ab 100644 --- a/doc/api/crypto.md +++ b/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'); diff --git a/doc/api/querystring.md b/doc/api/querystring.md index 3a10604020db90..f1f48fadd5fc29 100644 --- a/doc/api/querystring.md +++ b/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) diff --git a/doc/guides/writing-tests.md b/doc/guides/writing-tests.md index fbb1d55309a44b..64181586b539c4 100644 --- a/doc/guides/writing-tests.md +++ b/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