Skip to content

Commit d66cb4a

Browse files
committed
benchmark,doc,lib,test: capitalize comments
This updates a lot of comments. PR-URL: #26223 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
1 parent 3f4b27d commit d66cb4a

File tree

202 files changed

+348
-349
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+348
-349
lines changed

.eslintrc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,9 @@ module.exports = {
6060
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
6161
'capitalized-comments': ['error', 'always', {
6262
line: {
63-
// Ignore all lines that have less characters than 50 and all lines that
63+
// Ignore all lines that have less characters than 40 and all lines that
6464
// start with something that looks like a variable name or code.
65-
ignorePattern: '^.{0,50}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]',
65+
ignorePattern: '^.{0,40}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]|^ std',
6666
ignoreInlineComments: true,
6767
ignoreConsecutiveComments: true,
6868
},

benchmark/_cli.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function CLI(usage, settings) {
2828
}
2929

3030
let currentOptional = null;
31-
let mode = 'both'; // possible states are: [both, option, item]
31+
let mode = 'both'; // Possible states are: [both, option, item]
3232

3333
for (const arg of process.argv.slice(2)) {
3434
if (arg === '--') {
@@ -59,7 +59,7 @@ function CLI(usage, settings) {
5959
this.optional[currentOptional] = arg;
6060
}
6161

62-
// the next value can be either an option or an item
62+
// The next value can be either an option or an item
6363
mode = 'both';
6464
} else if (['both', 'item'].includes(mode)) {
6565
// item arguments

benchmark/crypto/cipher-stream.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function main({ api, cipher, type, len, writes }) {
1515
cipher = 'AES192';
1616
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
1717
console.error('Crypto streams not available until v0.10');
18-
// use the legacy, just so that we can compare them.
18+
// Use the legacy, just so that we can compare them.
1919
api = 'legacy';
2020
}
2121

benchmark/crypto/hash-stream-creation.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, {
1616
function main({ api, type, len, out, writes, algo }) {
1717
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
1818
console.error('Crypto streams not available until v0.10');
19-
// use the legacy, just so that we can compare them.
19+
// Use the legacy, just so that we can compare them.
2020
api = 'legacy';
2121
}
2222

@@ -54,7 +54,7 @@ function legacyWrite(algo, message, encoding, writes, len, outEnc) {
5454
h.update(message, encoding);
5555
var res = h.digest(outEnc);
5656

57-
// include buffer creation costs for older versions
57+
// Include buffer creation costs for older versions
5858
if (outEnc === 'buffer' && typeof res === 'string')
5959
res = Buffer.from(res, 'binary');
6060
}

benchmark/crypto/hash-stream-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const bench = common.createBenchmark(main, {
1515
function main({ api, type, len, algo, writes }) {
1616
if (api === 'stream' && /^v0\.[0-8]\./.test(process.version)) {
1717
console.error('Crypto streams not available until v0.10');
18-
// use the legacy, just so that we can compare them.
18+
// Use the legacy, just so that we can compare them.
1919
api = 'legacy';
2020
}
2121

benchmark/crypto/rsa-encrypt-decrypt-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
// throughput benchmark in signing and verifying
2+
// Throughput benchmark in signing and verifying
33
const common = require('../common.js');
44
const crypto = require('crypto');
55
const fs = require('fs');

benchmark/crypto/rsa-sign-verify-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
'use strict';
2-
// throughput benchmark in signing and verifying
2+
// Throughput benchmark in signing and verifying
33
const common = require('../common.js');
44
const crypto = require('crypto');
55
const fs = require('fs');

benchmark/fs/read-stream-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the throughput of the fs.WriteStream class.
1+
// Test the throughput of the fs.WriteStream class.
22
'use strict';
33

44
const path = require('path');

benchmark/fs/write-stream-throughput.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the throughput of the fs.WriteStream class.
1+
// Test the throughput of the fs.WriteStream class.
22
'use strict';
33

44
const path = require('path');

benchmark/net/tcp-raw-c2s.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common.js');
66
const util = require('util');
77

8-
// if there are --dur=N and --len=N args, then
8+
// If there are --dur=N and --len=N args, then
99
// run the function with those settings.
1010
// if not, then queue up a bunch of child processes.
1111
const bench = common.createBenchmark(main, {
@@ -36,7 +36,7 @@ function main({ dur, len, type }) {
3636
if (err)
3737
fail(err, 'connect');
3838

39-
// the meat of the benchmark is right here:
39+
// The meat of the benchmark is right here:
4040
bench.start();
4141
var bytes = 0;
4242

benchmark/net/tcp-raw-pipe.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
const common = require('../common.js');
66
const util = require('util');
77

8-
// if there are --dur=N and --len=N args, then
8+
// If there are --dur=N and --len=N args, then
99
// run the function with those settings.
1010
// if not, then queue up a bunch of child processes.
1111
const bench = common.createBenchmark(main, {

benchmark/net/tcp-raw-s2c.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ function main({ dur, len, type }) {
122122

123123
clientHandle.readStart();
124124

125-
// the meat of the benchmark is right here:
125+
// The meat of the benchmark is right here:
126126
bench.start();
127127

128128
setTimeout(() => {

doc/api/child_process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1070,7 +1070,7 @@ const subprocess = spawn(
10701070
);
10711071

10721072
setTimeout(() => {
1073-
subprocess.kill(); // does not terminate the node process in the shell
1073+
subprocess.kill(); // Does not terminate the node process in the shell
10741074
}, 2000);
10751075
```
10761076

doc/api/domain.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ if (cluster.isMaster) {
128128
// Anything can happen now! Be very careful!
129129

130130
try {
131-
// make sure we close down within 30 seconds
131+
// Make sure we close down within 30 seconds
132132
const killtimer = setTimeout(() => {
133133
process.exit(1);
134134
}, 30000);
@@ -148,7 +148,7 @@ if (cluster.isMaster) {
148148
res.setHeader('content-type', 'text/plain');
149149
res.end('Oops, there was a problem!\n');
150150
} catch (er2) {
151-
// oh well, not much we can do at this point.
151+
// Oh well, not much we can do at this point.
152152
console.error(`Error sending 500! ${er2.stack}`);
153153
}
154154
});
@@ -240,13 +240,13 @@ perhaps we would like to have a separate domain to use for each request.
240240
That is possible via explicit binding.
241241

242242
```js
243-
// create a top-level domain for the server
243+
// Create a top-level domain for the server
244244
const domain = require('domain');
245245
const http = require('http');
246246
const serverDomain = domain.create();
247247

248248
serverDomain.run(() => {
249-
// server is created in the scope of serverDomain
249+
// Server is created in the scope of serverDomain
250250
http.createServer((req, res) => {
251251
// Req and res are also created in the scope of serverDomain
252252
// however, we'd prefer to have a separate domain for each request.
@@ -373,7 +373,7 @@ const d = domain.create();
373373

374374
function readSomeFile(filename, cb) {
375375
fs.readFile(filename, 'utf8', d.intercept((data) => {
376-
// note, the first argument is never passed to the
376+
// Note, the first argument is never passed to the
377377
// callback since it is assumed to be the 'Error' argument
378378
// and thus intercepted by the domain.
379379

doc/api/http.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ http.get({
101101
hostname: 'localhost',
102102
port: 80,
103103
path: '/',
104-
agent: false // create a new agent just for this one request
104+
agent: false // Create a new agent just for this one request
105105
}, (res) => {
106106
// Do stuff with response
107107
});

doc/api/http2.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2600,7 +2600,7 @@ const server = createSecureServer(
26002600
).listen(4443);
26012601

26022602
function onRequest(req, res) {
2603-
// detects if it is a HTTPS request or HTTP/2
2603+
// Detects if it is a HTTPS request or HTTP/2
26042604
const { socket: { alpnProtocol } } = req.httpVersion === '2.0' ?
26052605
req.stream.session : req;
26062606
res.writeHead(200, { 'content-type': 'application/json' });
@@ -3373,9 +3373,9 @@ const obs = new PerformanceObserver((items) => {
33733373
const entry = items.getEntries()[0];
33743374
console.log(entry.entryType); // prints 'http2'
33753375
if (entry.name === 'Http2Session') {
3376-
// entry contains statistics about the Http2Session
3376+
// Entry contains statistics about the Http2Session
33773377
} else if (entry.name === 'Http2Stream') {
3378-
// entry contains statistics about the Http2Stream
3378+
// Entry contains statistics about the Http2Stream
33793379
}
33803380
});
33813381
obs.observe({ entryTypes: ['http2'] });

doc/api/inspector.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ session.connect();
167167

168168
session.post('Profiler.enable', () => {
169169
session.post('Profiler.start', () => {
170-
// invoke business logic under measurement here...
170+
// Invoke business logic under measurement here...
171171

172172
// some time later...
173173
session.post('Profiler.stop', (err, { profile }) => {

doc/api/querystring.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ Any other input values will be coerced to empty strings.
109109

110110
```js
111111
querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' });
112-
// returns 'foo=bar&baz=qux&baz=quux&corge='
112+
// Returns 'foo=bar&baz=qux&baz=quux&corge='
113113

114114
querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':');
115115
// returns 'foo:bar;baz:qux'

doc/api/stream.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const server = http.createServer((req, res) => {
135135
req.on('end', () => {
136136
try {
137137
const data = JSON.parse(body);
138-
// write back something interesting to the user:
138+
// Write back something interesting to the user:
139139
res.write(typeof data);
140140
res.end();
141141
} catch (er) {
@@ -413,7 +413,7 @@ Calling the [`stream.write()`][stream-write] method after calling
413413
[`stream.end()`][stream-end] will raise an error.
414414

415415
```js
416-
// write 'hello, ' and then end with 'world!'
416+
// Write 'hello, ' and then end with 'world!'
417417
const fs = require('fs');
418418
const file = fs.createWriteStream('example.txt');
419419
file.write('hello, ');
@@ -684,7 +684,7 @@ pass.unpipe(writable);
684684

685685
pass.on('data', (chunk) => { console.log(chunk.toString()); });
686686
pass.write('ok'); // will not emit 'data'
687-
pass.resume(); // must be called to make stream emit 'data'
687+
pass.resume(); // Must be called to make stream emit 'data'
688688
```
689689

690690
While `readable.readableFlowing` is `false`, data may be accumulating
@@ -1211,7 +1211,7 @@ function parseHeader(stream, callback) {
12111211
const remaining = split.join('\n\n');
12121212
const buf = Buffer.from(remaining, 'utf8');
12131213
stream.removeListener('error', callback);
1214-
// remove the 'readable' listener before unshifting
1214+
// Remove the 'readable' listener before unshifting
12151215
stream.removeListener('readable', onReadable);
12161216
if (buf.length)
12171217
stream.unshift(buf);

doc/api/util.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ const util = require('util');
158158

159159
const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001');
160160
const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001');
161-
fn1(); // emits a deprecation warning with code DEP0001
161+
fn1(); // Emits a deprecation warning with code DEP0001
162162
fn2(); // Does not emit a deprecation warning because it has the same code
163163
```
164164

lib/_stream_duplex.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
131131
return;
132132
}
133133

134-
// backward compatibility, the user is explicitly
134+
// Backward compatibility, the user is explicitly
135135
// managing destroyed
136136
this._readableState.destroyed = value;
137137
this._writableState.destroyed = value;

lib/_stream_readable.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ function ReadableState(options, stream, isDuplex) {
133133
// The number of writers that are awaiting a drain event in .pipe()s
134134
this.awaitDrain = 0;
135135

136-
// if true, a maybeReadMore has been scheduled
136+
// If true, a maybeReadMore has been scheduled
137137
this.readingMore = false;
138138

139139
this.decoder = null;
@@ -188,7 +188,7 @@ Object.defineProperty(Readable.prototype, 'destroyed', {
188188
return;
189189
}
190190

191-
// backward compatibility, the user is explicitly
191+
// Backward compatibility, the user is explicitly
192192
// managing destroyed
193193
this._readableState.destroyed = value;
194194
}
@@ -668,7 +668,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
668668
var cleanedUp = false;
669669
function cleanup() {
670670
debug('cleanup');
671-
// cleanup event handlers once the pipe is broken
671+
// Cleanup event handlers once the pipe is broken
672672
dest.removeListener('close', onclose);
673673
dest.removeListener('finish', onfinish);
674674
dest.removeListener('drain', ondrain);
@@ -744,7 +744,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
744744
// tell the dest that it's being piped to
745745
dest.emit('pipe', src);
746746

747-
// start the flow if it hasn't been started already.
747+
// Start the flow if it hasn't been started already.
748748
if (!state.flowing) {
749749
debug('pipe resume');
750750
src.resume();
@@ -771,13 +771,13 @@ Readable.prototype.unpipe = function(dest) {
771771
var state = this._readableState;
772772
var unpipeInfo = { hasUnpiped: false };
773773

774-
// if we're not piping anywhere, then do nothing.
774+
// If we're not piping anywhere, then do nothing.
775775
if (state.pipesCount === 0)
776776
return this;
777777

778-
// just one destination. most common case.
778+
// Just one destination. most common case.
779779
if (state.pipesCount === 1) {
780-
// passed in one, but it's not the right one.
780+
// Passed in one, but it's not the right one.
781781
if (dest && dest !== state.pipes)
782782
return this;
783783

@@ -823,7 +823,7 @@ Readable.prototype.unpipe = function(dest) {
823823
return this;
824824
};
825825

826-
// set up data events if they are asked for
826+
// Set up data events if they are asked for
827827
// Ensure readable listeners eventually get something
828828
Readable.prototype.on = function(ev, fn) {
829829
const res = Stream.prototype.on.call(this, ev, fn);
@@ -892,7 +892,7 @@ function updateReadableListening(self) {
892892
state.readableListening = self.listenerCount('readable') > 0;
893893

894894
if (state.resumeScheduled && !state.paused) {
895-
// flowing needs to be set to true now, otherwise
895+
// Flowing needs to be set to true now, otherwise
896896
// the upcoming resume will not flow.
897897
state.flowing = true;
898898

@@ -913,7 +913,7 @@ Readable.prototype.resume = function() {
913913
var state = this._readableState;
914914
if (!state.flowing) {
915915
debug('resume');
916-
// we flow only if there is no one listening
916+
// We flow only if there is no one listening
917917
// for readable, but we still have to call
918918
// resume()
919919
state.flowing = !state.readableListening;
@@ -983,7 +983,7 @@ Readable.prototype.wrap = function(stream) {
983983
if (state.decoder)
984984
chunk = state.decoder.write(chunk);
985985

986-
// don't skip over falsy values in objectMode
986+
// Don't skip over falsy values in objectMode
987987
if (state.objectMode && (chunk === null || chunk === undefined))
988988
return;
989989
else if (!state.objectMode && (!chunk || !chunk.length))

0 commit comments

Comments
 (0)