Skip to content

Commit 52a0d76

Browse files
committed
benchmark,doc,lib,test: capitalize comments
PR-URL: #26483 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com>
1 parent 1242037 commit 52a0d76

File tree

226 files changed

+460
-463
lines changed

Some content is hidden

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

226 files changed

+460
-463
lines changed

benchmark/_cli.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function CLI(usage, settings) {
6565
// item arguments
6666
this.items.push(arg);
6767

68-
// the next value must be an item
68+
// The next value must be an item
6969
mode = 'item';
7070
} else {
7171
// Bad case, abort

benchmark/net/net-c2s-cork.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the speed of .pipe() with sockets
1+
// Test the speed of .pipe() with sockets
22
'use strict';
33

44
const common = require('../common.js');
@@ -78,7 +78,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
7878
return true;
7979
};
8080

81-
// doesn't matter, never emits anything.
81+
// Doesn't matter, never emits anything.
8282
Writer.prototype.on = function() {};
8383
Writer.prototype.once = function() {};
8484
Writer.prototype.emit = function() {};

benchmark/net/net-c2s.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the speed of .pipe() with sockets
1+
// Test the speed of .pipe() with sockets
22
'use strict';
33

44
const common = require('../common.js');
@@ -72,7 +72,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
7272
return true;
7373
};
7474

75-
// doesn't matter, never emits anything.
75+
// Doesn't matter, never emits anything.
7676
Writer.prototype.on = function() {};
7777
Writer.prototype.once = function() {};
7878
Writer.prototype.emit = function() {};

benchmark/net/net-pipe.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the speed of .pipe() with sockets
1+
// Test the speed of .pipe() with sockets
22
'use strict';
33

44
const common = require('../common.js');
@@ -75,7 +75,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
7575
return true;
7676
};
7777

78-
// doesn't matter, never emits anything.
78+
// Doesn't matter, never emits anything.
7979
Writer.prototype.on = function() {};
8080
Writer.prototype.once = function() {};
8181
Writer.prototype.emit = function() {};

benchmark/net/net-s2c.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// test the speed of .pipe() with sockets
1+
// Test the speed of .pipe() with sockets
22
'use strict';
33

44
const common = require('../common.js');
@@ -73,7 +73,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
7373
return true;
7474
};
7575

76-
// doesn't matter, never emits anything.
76+
// Doesn't matter, never emits anything.
7777
Writer.prototype.on = function() {};
7878
Writer.prototype.once = function() {};
7979
Writer.prototype.emit = function() {};

benchmark/net/net-wrap-js-stream-passthrough.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
6868
return true;
6969
};
7070

71-
// doesn't matter, never emits anything.
71+
// Doesn't matter, never emits anything.
7272
Writer.prototype.on = function() {};
7373
Writer.prototype.once = function() {};
7474
Writer.prototype.emit = function() {};

benchmark/net/tcp-raw-s2c.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
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.
10-
// if not, then queue up a bunch of child processes.
10+
// If not, then queue up a bunch of child processes.
1111
const bench = common.createBenchmark(main, {
1212
len: [102400, 1024 * 1024 * 16],
1313
type: ['utf', 'asc', 'buf'],

benchmark/run.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ if (format === 'csv') {
5050
for (const key of Object.keys(data.conf)) {
5151
conf += ` ${key}=${JSON.stringify(data.conf[key])}`;
5252
}
53-
// delete first space of the configuration
53+
// Delete first space of the configuration
5454
conf = conf.slice(1);
5555
if (format === 'csv') {
5656
// Escape quotes (") for correct csv formatting

benchmark/timers/immediate.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ function depth1(N) {
5757
}
5858
}
5959

60-
// concurrent setImmediate, 0 arguments
60+
// Concurrent setImmediate, 0 arguments
6161
function breadth(N) {
6262
var n = 0;
6363
bench.start();
@@ -71,7 +71,7 @@ function breadth(N) {
7171
}
7272
}
7373

74-
// concurrent setImmediate, 1 argument
74+
// Concurrent setImmediate, 1 argument
7575
function breadth1(N) {
7676
var n = 0;
7777
bench.start();
@@ -85,7 +85,7 @@ function breadth1(N) {
8585
}
8686
}
8787

88-
// concurrent setImmediate, 4 arguments
88+
// Concurrent setImmediate, 4 arguments
8989
function breadth4(N) {
9090
N /= 2;
9191
var n = 0;

doc/api/cluster.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ if (cluster.isMaster) {
237237
res.writeHead(200);
238238
res.end('hello world\n');
239239

240-
// notify master about the request
240+
// Notify master about the request
241241
process.send({ cmd: 'notifyRequest' });
242242
}).listen(8000);
243243
}

doc/api/dgram.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ server.on('listening', () => {
2727
});
2828

2929
server.bind(41234);
30-
// server listening 0.0.0.0:41234
30+
// Prints: server listening 0.0.0.0:41234
3131
```
3232

3333
## Class: dgram.Socket
@@ -172,7 +172,7 @@ server.on('listening', () => {
172172
});
173173

174174
server.bind(41234);
175-
// server listening 0.0.0.0:41234
175+
// Prints: server listening 0.0.0.0:41234
176176
```
177177

178178
### socket.bind(options[, callback])

doc/api/domain.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ d.on('error', (er) => {
420420
});
421421
d.run(() => {
422422
process.nextTick(() => {
423-
setTimeout(() => { // simulating some various async stuff
423+
setTimeout(() => { // Simulating some various async stuff
424424
fs.open('non-existent file', 'r', (er, fd) => {
425425
if (er) throw er;
426426
// proceed...

doc/api/errors.md

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

159159
try {
160160
fs.readFile('/some/file/that/does-not-exist', (err, data) => {
161-
// mistaken assumption: throwing here...
161+
// Mistaken assumption: throwing here...
162162
if (err) {
163163
throw err;
164164
}
@@ -217,7 +217,7 @@ a string representing the location in the code at which
217217
```js
218218
const myObject = {};
219219
Error.captureStackTrace(myObject);
220-
myObject.stack; // similar to `new Error().stack`
220+
myObject.stack; // Similar to `new Error().stack`
221221
```
222222

223223
The first line of the trace will be prefixed with
@@ -316,7 +316,7 @@ will not be present in the stack traces:
316316
const cheetahify = require('./native-binding.node');
317317

318318
function makeFaster() {
319-
// cheetahify *synchronously* calls speedy.
319+
// `cheetahify()` *synchronously* calls speedy.
320320
cheetahify(function speedy() {
321321
throw new Error('oh no!');
322322
});

doc/api/fs.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1908,7 +1908,7 @@ console.log(fs.readFileSync('temp.txt', 'utf8'));
19081908
// get the file descriptor of the file to be truncated
19091909
const fd = fs.openSync('temp.txt', 'r+');
19101910

1911-
// truncate the file to first four bytes
1911+
// Truncate the file to first four bytes
19121912
fs.ftruncate(fd, 4, (err) => {
19131913
assert.ifError(err);
19141914
console.log(fs.readFileSync('temp.txt', 'utf8'));
@@ -3899,7 +3899,7 @@ async function doTruncate() {
38993899
await filehandle.truncate(4);
39003900
} finally {
39013901
if (filehandle) {
3902-
// close the file if it is opened.
3902+
// Close the file if it is opened.
39033903
await filehandle.close();
39043904
}
39053905
}
@@ -3926,7 +3926,7 @@ async function doTruncate() {
39263926
await filehandle.truncate(10);
39273927
} finally {
39283928
if (filehandle) {
3929-
// close the file if it is opened.
3929+
// Close the file if it is opened.
39303930
await filehandle.close();
39313931
}
39323932
}

doc/api/http.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ proxy.on('connect', (req, cltSocket, head) => {
373373
// now that proxy is running
374374
proxy.listen(1337, '127.0.0.1', () => {
375375

376-
// make a request to a tunneling proxy
376+
// Make a request to a tunneling proxy
377377
const options = {
378378
port: 1337,
379379
host: '127.0.0.1',
@@ -387,7 +387,7 @@ proxy.listen(1337, '127.0.0.1', () => {
387387
req.on('connect', (res, socket, head) => {
388388
console.log('got connected!');
389389

390-
// make a request over an HTTP tunnel
390+
// Make a request over an HTTP tunnel
391391
socket.write('GET / HTTP/1.1\r\n' +
392392
'Host: www.google.com:80\r\n' +
393393
'Connection: close\r\n' +
@@ -1307,7 +1307,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
13071307
to [`response.writeHead()`][] given precedence.
13081308

13091309
```js
1310-
// returns content-type = text/plain
1310+
// Returns content-type = text/plain
13111311
const server = http.createServer((req, res) => {
13121312
res.setHeader('Content-Type', 'text/html');
13131313
res.setHeader('X-Foo', 'bar');
@@ -1500,7 +1500,7 @@ desired with potential future retrieval and modification, use
15001500
[`response.setHeader()`][] instead.
15011501

15021502
```js
1503-
// returns content-type = text/plain
1503+
// Returns content-type = text/plain
15041504
const server = http.createServer((req, res) => {
15051505
res.setHeader('Content-Type', 'text/html');
15061506
res.setHeader('X-Foo', 'bar');
@@ -1912,7 +1912,7 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
19121912
}
19131913
if (error) {
19141914
console.error(error.message);
1915-
// consume response data to free up memory
1915+
// Consume response data to free up memory
19161916
res.resume();
19171917
return;
19181918
}

doc/api/http2.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -3138,7 +3138,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
31383138
to [`response.writeHead()`][] given precedence.
31393139

31403140
```js
3141-
// returns content-type = text/plain
3141+
// Returns content-type = text/plain
31423142
const server = http2.createServer((req, res) => {
31433143
res.setHeader('Content-Type', 'text/html');
31443144
res.setHeader('X-Foo', 'bar');
@@ -3332,7 +3332,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
33323332
to [`response.writeHead()`][] given precedence.
33333333

33343334
```js
3335-
// returns content-type = text/plain
3335+
// Returns content-type = text/plain
33363336
const server = http2.createServer((req, res) => {
33373337
res.setHeader('Content-Type', 'text/html');
33383338
res.setHeader('X-Foo', 'bar');

doc/api/inspector.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ session.post('Profiler.enable', () => {
171171

172172
// some time later...
173173
session.post('Profiler.stop', (err, { profile }) => {
174-
// write profile to disk, upload, etc.
174+
// Write profile to disk, upload, etc.
175175
if (!err) {
176176
fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));
177177
}

doc/api/modules.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ added: v10.12.0
921921
const { createRequireFromPath } = require('module');
922922
const requireUtil = createRequireFromPath('../src/utils');
923923

924-
// require `../src/utils/some-tool`
924+
// Require `../src/utils/some-tool`
925925
requireUtil('./some-tool');
926926
```
927927

doc/api/net.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ const server = net.createServer((socket) => {
132132
throw err;
133133
});
134134

135-
// grab an arbitrary unused port.
135+
// Grab an arbitrary unused port.
136136
server.listen(() => {
137137
console.log('opened server on', server.address());
138138
});

doc/api/perf_hooks.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ const {
331331
} = require('perf_hooks');
332332

333333
const obs = new PerformanceObserver((list, observer) => {
334-
// Called three times synchronously. list contains one item
334+
// Called three times synchronously. `list` contains one item.
335335
});
336336
obs.observe({ entryTypes: ['mark'] });
337337

@@ -346,7 +346,7 @@ const {
346346
} = require('perf_hooks');
347347

348348
const obs = new PerformanceObserver((list, observer) => {
349-
// called once. list contains three items
349+
// Called once. `list` contains three items.
350350
});
351351
obs.observe({ entryTypes: ['mark'], buffered: true });
352352

doc/api/process.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1286,7 +1286,7 @@ setTimeout(() => {
12861286
// [ 1, 552 ]
12871287

12881288
console.log(`Benchmark took ${diff[0] * NS_PER_SEC + diff[1]} nanoseconds`);
1289-
// benchmark took 1000000552 nanoseconds
1289+
// Benchmark took 1000000552 nanoseconds
12901290
}, 1000);
12911291
```
12921292

doc/api/readline.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`.
457457
function completer(line) {
458458
const completions = '.help .error .exit .quit .q'.split(' ');
459459
const hits = completions.filter((c) => c.startsWith(line));
460-
// show all completions if none found
460+
// Show all completions if none found
461461
return [hits.length ? hits : completions, line];
462462
}
463463
```

doc/api/stream.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,8 @@ function writeOneMillionTimes(writer, data, encoding, callback) {
256256
// last time!
257257
writer.write(data, encoding, callback);
258258
} else {
259-
// see if we should continue, or wait
260-
// don't pass the callback, because we're not done yet.
259+
// See if we should continue, or wait.
260+
// Don't pass the callback, because we're not done yet.
261261
ok = writer.write(data, encoding);
262262
}
263263
} while (i > 0 && ok);
@@ -418,7 +418,7 @@ const fs = require('fs');
418418
const file = fs.createWriteStream('example.txt');
419419
file.write('hello, ');
420420
file.end('world!');
421-
// writing more now is not allowed!
421+
// Writing more now is not allowed!
422422
```
423423

424424
##### writable.setDefaultEncoding(encoding)
@@ -819,7 +819,7 @@ cause some amount of data to be read into an internal buffer.
819819
```javascript
820820
const readable = getReadableStreamSomehow();
821821
readable.on('readable', function() {
822-
// there is some data to read now
822+
// There is some data to read now
823823
let data;
824824

825825
while (data = this.read()) {
@@ -2431,7 +2431,7 @@ net.createServer((socket) => {
24312431
socket.end('The message was received but was not processed.\n');
24322432
});
24332433

2434-
// start the flow of data, discarding it.
2434+
// Start the flow of data, discarding it.
24352435
socket.resume();
24362436
}).listen(1337);
24372437
```

lib/_http_agent.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
162162
var sockLen = freeLen + this.sockets[name].length;
163163

164164
if (freeLen) {
165-
// we have a free socket, so use that.
165+
// We have a free socket, so use that.
166166
var socket = this.freeSockets[name].shift();
167167
// Guard against an uninitialized or user supplied Socket.
168168
if (socket._handle && typeof socket._handle.asyncReset === 'function') {
@@ -357,7 +357,7 @@ function setRequestSocket(agent, req, socket) {
357357
return;
358358
}
359359
socket.setTimeout(req.timeout);
360-
// reset timeout after response end
360+
// Reset timeout after response end
361361
req.once('response', (res) => {
362362
res.once('end', () => {
363363
if (socket.timeout !== agentTimeout) {

0 commit comments

Comments
 (0)