summaryrefslogtreecommitdiff
path: root/doc/api
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-22 03:44:26 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2019-03-27 17:20:06 +0100
commitb08a867d6016ccf04783a0f91fdbcc3460daf234 (patch)
tree5df4b30220cde5ae5eac9ed956c9badac6ba08af /doc/api
parentfd992e6e36bb4b01a6ceb71cfeb3bae640b492a6 (diff)
downloadandroid-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.tar.gz
android-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.tar.bz2
android-node-v8-b08a867d6016ccf04783a0f91fdbcc3460daf234.zip
benchmark,doc,lib: capitalize more comments
PR-URL: https://github.com/nodejs/node/pull/26849 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Diffstat (limited to 'doc/api')
-rw-r--r--doc/api/cluster.md2
-rw-r--r--doc/api/console.md4
-rw-r--r--doc/api/domain.md12
-rw-r--r--doc/api/errors.md4
-rw-r--r--doc/api/events.md2
-rw-r--r--doc/api/http.md16
-rw-r--r--doc/api/http2.md2
-rw-r--r--doc/api/process.md4
-rw-r--r--doc/api/querystring.md2
-rw-r--r--doc/api/stream.md6
-rw-r--r--doc/api/timers.md2
-rw-r--r--doc/api/util.md2
-rw-r--r--doc/api/zlib.md2
13 files changed, 29 insertions, 31 deletions
diff --git a/doc/api/cluster.md b/doc/api/cluster.md
index 90e64239b3..340c2968cb 100644
--- a/doc/api/cluster.md
+++ b/doc/api/cluster.md
@@ -315,7 +315,7 @@ if (cluster.isMaster) {
} else if (cluster.isWorker) {
const net = require('net');
const server = net.createServer((socket) => {
- // connections never end
+ // Connections never end
});
server.listen(8000);
diff --git a/doc/api/console.md b/doc/api/console.md
index 1fe1949664..a8369290df 100644
--- a/doc/api/console.md
+++ b/doc/api/console.md
@@ -114,12 +114,12 @@ error output. If `stderr` is not provided, `stdout` is used for `stderr`.
```js
const output = fs.createWriteStream('./stdout.log');
const errorOutput = fs.createWriteStream('./stderr.log');
-// custom simple logger
+// Custom simple logger
const logger = new Console({ stdout: output, stderr: errorOutput });
// use it like console
const count = 5;
logger.log('count: %d', count);
-// in stdout.log: count 5
+// In stdout.log: count 5
```
The global `console` is a special `Console` whose output is sent to
diff --git a/doc/api/domain.md b/doc/api/domain.md
index 226eb660f4..63dbcabbbc 100644
--- a/doc/api/domain.md
+++ b/doc/api/domain.md
@@ -135,7 +135,7 @@ if (cluster.isMaster) {
// But don't keep the process open just for that!
killtimer.unref();
- // stop taking new requests.
+ // Stop taking new requests.
server.close();
// Let the master know we're dead. This will trigger a
@@ -316,14 +316,13 @@ const d = domain.create();
function readSomeFile(filename, cb) {
fs.readFile(filename, 'utf8', d.bind((er, data) => {
- // If this throws, it will also be passed to the domain
+ // If this throws, it will also be passed to the domain.
return cb(er, data ? JSON.parse(data) : null);
}));
}
d.on('error', (er) => {
- // an error occurred somewhere.
- // if we throw it now, it will crash the program
+ // An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
@@ -377,7 +376,7 @@ function readSomeFile(filename, cb) {
// callback since it is assumed to be the 'Error' argument
// and thus intercepted by the domain.
- // if this throws, it will also be passed to the domain
+ // If this throws, it will also be passed to the domain
// so the error-handling logic can be moved to the 'error'
// event on the domain instead of being repeated throughout
// the program.
@@ -386,8 +385,7 @@ function readSomeFile(filename, cb) {
}
d.on('error', (er) => {
- // an error occurred somewhere.
- // if we throw it now, it will crash the program
+ // An error occurred somewhere. If we throw it now, it will crash the program
// with the normal line number and stack message.
});
```
diff --git a/doc/api/errors.md b/doc/api/errors.md
index 18774a9b95..7e32ba1cfc 100644
--- a/doc/api/errors.md
+++ b/doc/api/errors.md
@@ -407,7 +407,7 @@ program.
try {
require('vm').runInThisContext('binary ! isNotOk');
} catch (err) {
- // err will be a SyntaxError
+ // 'err' will be a SyntaxError.
}
```
@@ -422,7 +422,7 @@ string would be considered a `TypeError`.
```js
require('url').parse(() => { });
-// throws TypeError, since it expected a string
+// Throws TypeError, since it expected a string.
```
Node.js will generate and throw `TypeError` instances *immediately* as a form
diff --git a/doc/api/events.md b/doc/api/events.md
index 8525bf5f24..74846995c2 100644
--- a/doc/api/events.md
+++ b/doc/api/events.md
@@ -648,7 +648,7 @@ emitter.on('log', () => console.log('log persistently'));
// Will return a new Array with a single function bound by `.on()` above
const newListeners = emitter.rawListeners('log');
-// logs "log persistently" twice
+// Logs "log persistently" twice
newListeners[0]();
emitter.emit('log');
```
diff --git a/doc/api/http.md b/doc/api/http.md
index d27fa462a8..455195d79f 100644
--- a/doc/api/http.md
+++ b/doc/api/http.md
@@ -358,7 +358,7 @@ const proxy = http.createServer((req, res) => {
res.end('okay');
});
proxy.on('connect', (req, cltSocket, head) => {
- // connect to an origin server
+ // Connect to an origin server
const srvUrl = url.parse(`http://${req.url}`);
const srvSocket = net.connect(srvUrl.port, srvUrl.hostname, () => {
cltSocket.write('HTTP/1.1 200 Connection Established\r\n' +
@@ -370,7 +370,7 @@ proxy.on('connect', (req, cltSocket, head) => {
});
});
-// now that proxy is running
+// Now that proxy is running
proxy.listen(1337, '127.0.0.1', () => {
// Make a request to a tunneling proxy
@@ -504,7 +504,7 @@ srv.on('upgrade', (req, socket, head) => {
socket.pipe(socket); // echo back
});
-// now that server is running
+// Now that server is running
srv.listen(1337, '127.0.0.1', () => {
// make a request
@@ -626,11 +626,11 @@ request.setHeader('content-type', 'text/html');
request.setHeader('Content-Length', Buffer.byteLength(body));
request.setHeader('Cookie', ['type=ninja', 'language=javascript']);
const contentType = request.getHeader('Content-Type');
-// contentType is 'text/html'
+// 'contentType' is 'text/html'
const contentLength = request.getHeader('Content-Length');
-// contentLength is of type number
+// 'contentLength' is of type number
const cookie = request.getHeader('Cookie');
-// cookie is of type string[]
+// 'cookie' is of type string[]
```
### request.maxHeadersCount
@@ -745,7 +745,7 @@ req.once('response', (res) => {
const ip = req.socket.localAddress;
const port = req.socket.localPort;
console.log(`Your IP address is ${ip} and your source port is ${port}.`);
- // consume response object
+ // Consume response object
});
```
@@ -2065,7 +2065,7 @@ req.on('error', (e) => {
console.error(`problem with request: ${e.message}`);
});
-// write data to request body
+// Write data to request body
req.write(postData);
req.end();
```
diff --git a/doc/api/http2.md b/doc/api/http2.md
index 04a4972de7..1416c97636 100644
--- a/doc/api/http2.md
+++ b/doc/api/http2.md
@@ -2437,7 +2437,7 @@ const client = http2.connect('http://localhost');
client.on('stream', (pushedStream, requestHeaders) => {
pushedStream.on('push', (responseHeaders) => {
- // process response headers
+ // Process response headers
});
pushedStream.on('data', (chunk) => { /* handle pushed data */ });
});
diff --git a/doc/api/process.md b/doc/api/process.md
index 27ba6db319..ed5e38dd4c 100644
--- a/doc/api/process.md
+++ b/doc/api/process.md
@@ -295,8 +295,8 @@ process.on('unhandledRejection', (reason, p) => {
});
somePromise.then((res) => {
- return reportToUser(JSON.pasre(res)); // note the typo (`pasre`)
-}); // no `.catch()` or `.then()`
+ return reportToUser(JSON.pasre(res)); // Note the typo (`pasre`)
+}); // No `.catch()` or `.then()`
```
The following will also trigger the `'unhandledRejection'` event to be
diff --git a/doc/api/querystring.md b/doc/api/querystring.md
index 1a1d0adb25..15fb35d22f 100644
--- a/doc/api/querystring.md
+++ b/doc/api/querystring.md
@@ -126,7 +126,7 @@ querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
// Returns 'foo=bar&baz=qux&baz=quux&corge='
querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
-// returns 'foo:bar;baz:qux'
+// Returns 'foo:bar;baz:qux'
```
By default, characters requiring percent-encoding within the query string will
diff --git a/doc/api/stream.md b/doc/api/stream.md
index 156f09f374..df171b9536 100644
--- a/doc/api/stream.md
+++ b/doc/api/stream.md
@@ -683,7 +683,7 @@ pass.unpipe(writable);
// readableFlowing is now false
pass.on('data', (chunk) => { console.log(chunk.toString()); });
-pass.write('ok'); // will not emit 'data'
+pass.write('ok'); // Will not emit 'data'
pass.resume(); // Must be called to make stream emit 'data'
```
@@ -1206,7 +1206,7 @@ function parseHeader(stream, callback) {
while (null !== (chunk = stream.read())) {
const str = decoder.write(chunk);
if (str.match(/\n\n/)) {
- // found the header boundary
+ // Found the header boundary
const split = str.split(/\n\n/);
header += split.shift();
const remaining = split.join('\n\n');
@@ -1219,7 +1219,7 @@ function parseHeader(stream, callback) {
// Now the body of the message can be read from the stream.
callback(null, header, stream);
} else {
- // still reading the header.
+ // Still reading the header.
header += str;
}
}
diff --git a/doc/api/timers.md b/doc/api/timers.md
index 9460028928..66ee2ca97e 100644
--- a/doc/api/timers.md
+++ b/doc/api/timers.md
@@ -163,7 +163,7 @@ setImmediatePromise('foobar').then((value) => {
// This is executed after all I/O callbacks.
});
-// or with async function
+// Or with async function
async function timerExample() {
console.log('Before I/O callbacks');
await setImmediatePromise();
diff --git a/doc/api/util.md b/doc/api/util.md
index 2ef115bc7d..beb79ae0f8 100644
--- a/doc/api/util.md
+++ b/doc/api/util.md
@@ -758,7 +758,7 @@ option properties directly is also supported.
const util = require('util');
const arr = Array(101).fill(0);
-console.log(arr); // logs the truncated array
+console.log(arr); // Logs the truncated array
util.inspect.defaultOptions.maxArrayLength = null;
console.log(arr); // logs the full array
```
diff --git a/doc/api/zlib.md b/doc/api/zlib.md
index 6efc2a709c..6d0371a8d9 100644
--- a/doc/api/zlib.md
+++ b/doc/api/zlib.md
@@ -69,7 +69,7 @@ See [Memory Usage Tuning][] for more information on the speed/memory/compression
tradeoffs involved in `zlib` usage.
```js
-// client request example
+// Client request example
const zlib = require('zlib');
const http = require('http');
const fs = require('fs');