Skip to content

Commit

Permalink
benchmark,doc,lib,test: capitalize comments
Browse files Browse the repository at this point in the history
PR-URL: #26483
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
  • Loading branch information
BridgeAR committed Mar 14, 2019
1 parent 1242037 commit 52a0d76
Show file tree
Hide file tree
Showing 226 changed files with 460 additions and 463 deletions.
2 changes: 1 addition & 1 deletion benchmark/_cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function CLI(usage, settings) {
// item arguments
this.items.push(arg);

// the next value must be an item
// The next value must be an item
mode = 'item';
} else {
// Bad case, abort
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-c2s-cork.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

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

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-c2s.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

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

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-pipe.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

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

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/net-s2c.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// test the speed of .pipe() with sockets
// Test the speed of .pipe() with sockets
'use strict';

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

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
2 changes: 1 addition & 1 deletion benchmark/net/net-wrap-js-stream-passthrough.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Writer.prototype.write = function(chunk, encoding, cb) {
return true;
};

// doesn't matter, never emits anything.
// Doesn't matter, never emits anything.
Writer.prototype.on = function() {};
Writer.prototype.once = function() {};
Writer.prototype.emit = function() {};
Expand Down
4 changes: 2 additions & 2 deletions benchmark/net/tcp-raw-s2c.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
const common = require('../common.js');
const util = require('util');

// if there are dur=N and len=N args, then
// If there are dur=N and len=N args, then
// run the function with those settings.
// if not, then queue up a bunch of child processes.
// If not, then queue up a bunch of child processes.
const bench = common.createBenchmark(main, {
len: [102400, 1024 * 1024 * 16],
type: ['utf', 'asc', 'buf'],
Expand Down
2 changes: 1 addition & 1 deletion benchmark/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if (format === 'csv') {
for (const key of Object.keys(data.conf)) {
conf += ` ${key}=${JSON.stringify(data.conf[key])}`;
}
// delete first space of the configuration
// Delete first space of the configuration
conf = conf.slice(1);
if (format === 'csv') {
// Escape quotes (") for correct csv formatting
Expand Down
6 changes: 3 additions & 3 deletions benchmark/timers/immediate.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ function depth1(N) {
}
}

// concurrent setImmediate, 0 arguments
// Concurrent setImmediate, 0 arguments
function breadth(N) {
var n = 0;
bench.start();
Expand All @@ -71,7 +71,7 @@ function breadth(N) {
}
}

// concurrent setImmediate, 1 argument
// Concurrent setImmediate, 1 argument
function breadth1(N) {
var n = 0;
bench.start();
Expand All @@ -85,7 +85,7 @@ function breadth1(N) {
}
}

// concurrent setImmediate, 4 arguments
// Concurrent setImmediate, 4 arguments
function breadth4(N) {
N /= 2;
var n = 0;
Expand Down
2 changes: 1 addition & 1 deletion doc/api/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ if (cluster.isMaster) {
res.writeHead(200);
res.end('hello world\n');

// notify master about the request
// Notify master about the request
process.send({ cmd: 'notifyRequest' });
}).listen(8000);
}
Expand Down
4 changes: 2 additions & 2 deletions doc/api/dgram.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ server.on('listening', () => {
});

server.bind(41234);
// server listening 0.0.0.0:41234
// Prints: server listening 0.0.0.0:41234
```

## Class: dgram.Socket
Expand Down Expand Up @@ -172,7 +172,7 @@ server.on('listening', () => {
});

server.bind(41234);
// server listening 0.0.0.0:41234
// Prints: server listening 0.0.0.0:41234
```

### socket.bind(options[, callback])
Expand Down
2 changes: 1 addition & 1 deletion doc/api/domain.md
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ d.on('error', (er) => {
});
d.run(() => {
process.nextTick(() => {
setTimeout(() => { // simulating some various async stuff
setTimeout(() => { // Simulating some various async stuff
fs.open('non-existent file', 'r', (er, fd) => {
if (er) throw er;
// proceed...
Expand Down
6 changes: 3 additions & 3 deletions doc/api/errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const fs = require('fs');

try {
fs.readFile('/some/file/that/does-not-exist', (err, data) => {
// mistaken assumption: throwing here...
// Mistaken assumption: throwing here...
if (err) {
throw err;
}
Expand Down Expand Up @@ -217,7 +217,7 @@ a string representing the location in the code at which
```js
const myObject = {};
Error.captureStackTrace(myObject);
myObject.stack; // similar to `new Error().stack`
myObject.stack; // Similar to `new Error().stack`
```

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

function makeFaster() {
// cheetahify *synchronously* calls speedy.
// `cheetahify()` *synchronously* calls speedy.
cheetahify(function speedy() {
throw new Error('oh no!');
});
Expand Down
6 changes: 3 additions & 3 deletions doc/api/fs.md
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ console.log(fs.readFileSync('temp.txt', 'utf8'));
// get the file descriptor of the file to be truncated
const fd = fs.openSync('temp.txt', 'r+');

// truncate the file to first four bytes
// Truncate the file to first four bytes
fs.ftruncate(fd, 4, (err) => {
assert.ifError(err);
console.log(fs.readFileSync('temp.txt', 'utf8'));
Expand Down Expand Up @@ -3899,7 +3899,7 @@ async function doTruncate() {
await filehandle.truncate(4);
} finally {
if (filehandle) {
// close the file if it is opened.
// Close the file if it is opened.
await filehandle.close();
}
}
Expand All @@ -3926,7 +3926,7 @@ async function doTruncate() {
await filehandle.truncate(10);
} finally {
if (filehandle) {
// close the file if it is opened.
// Close the file if it is opened.
await filehandle.close();
}
}
Expand Down
10 changes: 5 additions & 5 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ proxy.on('connect', (req, cltSocket, head) => {
// now that proxy is running
proxy.listen(1337, '127.0.0.1', () => {

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

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

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

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down Expand Up @@ -1912,7 +1912,7 @@ http.get('http://nodejs.org/dist/index.json', (res) => {
}
if (error) {
console.error(error.message);
// consume response data to free up memory
// Consume response data to free up memory
res.resume();
return;
}
Expand Down
4 changes: 2 additions & 2 deletions doc/api/http2.md
Original file line number Diff line number Diff line change
Expand Up @@ -3138,7 +3138,7 @@ with any headers passed to [`response.writeHead()`][], with the headers passed
to [`response.writeHead()`][] given precedence.

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

```js
// returns content-type = text/plain
// Returns content-type = text/plain
const server = http2.createServer((req, res) => {
res.setHeader('Content-Type', 'text/html');
res.setHeader('X-Foo', 'bar');
Expand Down
2 changes: 1 addition & 1 deletion doc/api/inspector.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ session.post('Profiler.enable', () => {

// some time later...
session.post('Profiler.stop', (err, { profile }) => {
// write profile to disk, upload, etc.
// Write profile to disk, upload, etc.
if (!err) {
fs.writeFileSync('./profile.cpuprofile', JSON.stringify(profile));
}
Expand Down
2 changes: 1 addition & 1 deletion doc/api/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,7 @@ added: v10.12.0
const { createRequireFromPath } = require('module');
const requireUtil = createRequireFromPath('../src/utils');

// require `../src/utils/some-tool`
// Require `../src/utils/some-tool`
requireUtil('./some-tool');
```

Expand Down
2 changes: 1 addition & 1 deletion doc/api/net.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const server = net.createServer((socket) => {
throw err;
});

// grab an arbitrary unused port.
// Grab an arbitrary unused port.
server.listen(() => {
console.log('opened server on', server.address());
});
Expand Down
4 changes: 2 additions & 2 deletions doc/api/perf_hooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ const {
} = require('perf_hooks');

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion doc/api/process.md
Original file line number Diff line number Diff line change
Expand Up @@ -1286,7 +1286,7 @@ setTimeout(() => {
// [ 1, 552 ]

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

Expand Down
2 changes: 1 addition & 1 deletion doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`.
function completer(line) {
const completions = '.help .error .exit .quit .q'.split(' ');
const hits = completions.filter((c) => c.startsWith(line));
// show all completions if none found
// Show all completions if none found
return [hits.length ? hits : completions, line];
}
```
Expand Down
10 changes: 5 additions & 5 deletions doc/api/stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,8 @@ function writeOneMillionTimes(writer, data, encoding, callback) {
// last time!
writer.write(data, encoding, callback);
} else {
// see if we should continue, or wait
// don't pass the callback, because we're not done yet.
// See if we should continue, or wait.
// Don't pass the callback, because we're not done yet.
ok = writer.write(data, encoding);
}
} while (i > 0 && ok);
Expand Down Expand Up @@ -418,7 +418,7 @@ const fs = require('fs');
const file = fs.createWriteStream('example.txt');
file.write('hello, ');
file.end('world!');
// writing more now is not allowed!
// Writing more now is not allowed!
```

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

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

// start the flow of data, discarding it.
// Start the flow of data, discarding it.
socket.resume();
}).listen(1337);
```
Expand Down
4 changes: 2 additions & 2 deletions lib/_http_agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */,
var sockLen = freeLen + this.sockets[name].length;

if (freeLen) {
// we have a free socket, so use that.
// We have a free socket, so use that.
var socket = this.freeSockets[name].shift();
// Guard against an uninitialized or user supplied Socket.
if (socket._handle && typeof socket._handle.asyncReset === 'function') {
Expand Down Expand Up @@ -357,7 +357,7 @@ function setRequestSocket(agent, req, socket) {
return;
}
socket.setTimeout(req.timeout);
// reset timeout after response end
// Reset timeout after response end
req.once('response', (res) => {
res.once('end', () => {
if (socket.timeout !== agentTimeout) {
Expand Down
Loading

0 comments on commit 52a0d76

Please sign in to comment.