summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2018-12-10 13:27:32 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-12-17 17:14:35 +0100
commit50dd555910ed0338c35f27ee57e947b9ec95724c (patch)
tree73a0d59eb5b1087afa4c42bc667bb268f1a23b72 /lib
parentbe3ae339360c9833a77ebf5772786d75b7a8dd78 (diff)
downloadandroid-node-v8-50dd555910ed0338c35f27ee57e947b9ec95724c.tar.gz
android-node-v8-50dd555910ed0338c35f27ee57e947b9ec95724c.tar.bz2
android-node-v8-50dd555910ed0338c35f27ee57e947b9ec95724c.zip
doc,lib,test: capitalize comment sentences
This activates the eslint capitalize comment rule for comments above 50 characters. PR-URL: https://github.com/nodejs/node/pull/24996 Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/_http_client.js2
-rw-r--r--lib/_http_common.js4
-rw-r--r--lib/_http_incoming.js2
-rw-r--r--lib/_http_server.js2
-rw-r--r--lib/_stream_duplex.js8
-rw-r--r--lib/_stream_readable.js38
-rw-r--r--lib/_stream_transform.js6
-rw-r--r--lib/_stream_writable.js24
-rw-r--r--lib/async_hooks.js2
-rw-r--r--lib/dgram.js2
-rw-r--r--lib/domain.js10
-rw-r--r--lib/events.js2
-rw-r--r--lib/fs.js12
-rw-r--r--lib/internal/child_process.js4
-rw-r--r--lib/internal/console/constructor.js2
-rw-r--r--lib/internal/fs/streams.js12
-rw-r--r--lib/internal/http2/compat.js2
-rw-r--r--lib/internal/http2/core.js4
-rw-r--r--lib/internal/modules/cjs/loader.js6
-rw-r--r--lib/internal/modules/esm/loader.js4
-rw-r--r--lib/internal/process/next_tick.js2
-rw-r--r--lib/internal/process/stdio.js4
-rw-r--r--lib/internal/streams/destroy.js2
-rw-r--r--lib/internal/timers.js2
-rw-r--r--lib/net.js10
-rw-r--r--lib/readline.js10
-rw-r--r--lib/repl.js4
-rw-r--r--lib/timers.js2
-rw-r--r--lib/url.js8
29 files changed, 96 insertions, 96 deletions
diff --git a/lib/_http_client.js b/lib/_http_client.js
index c90d9b9633..46605dce0c 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -555,7 +555,7 @@ function parserOnIncomingClient(res, shouldKeepAlive) {
req.res = res;
res.req = req;
- // add our listener first, so that we guarantee socket cleanup
+ // Add our listener first, so that we guarantee socket cleanup
res.on('end', responseOnEnd);
req.on('prefinish', requestOnPrefinish);
var handled = req.emit('response', res);
diff --git a/lib/_http_common.js b/lib/_http_common.js
index 9188e9c7ca..7ecef8b83d 100644
--- a/lib/_http_common.js
+++ b/lib/_http_common.js
@@ -116,11 +116,11 @@ function parserOnHeadersComplete(versionMajor, versionMinor, headers, method,
function parserOnBody(b, start, len) {
const stream = this.incoming;
- // if the stream has already been removed, then drop it.
+ // If the stream has already been removed, then drop it.
if (stream === null)
return;
- // pretend this was the result of a stream._read call.
+ // Pretend this was the result of a stream._read call.
if (len > 0 && !stream._dumped) {
var slice = b.slice(start, start + len);
var ret = stream.push(slice);
diff --git a/lib/_http_incoming.js b/lib/_http_incoming.js
index bf2fee6932..1e0c42f7bd 100644
--- a/lib/_http_incoming.js
+++ b/lib/_http_incoming.js
@@ -67,7 +67,7 @@ function IncomingMessage(socket) {
this.client = socket;
this._consuming = false;
- // flag for when we decide that this message cannot possibly be
+ // Flag for when we decide that this message cannot possibly be
// read by the user, so there's no point continuing to handle it.
this._dumped = false;
}
diff --git a/lib/_http_server.js b/lib/_http_server.js
index 7e33ef1734..6aad3584c2 100644
--- a/lib/_http_server.js
+++ b/lib/_http_server.js
@@ -574,7 +574,7 @@ function resOnFinish(req, res, socket, state, server) {
state.incoming.shift();
- // if the user never called req.read(), and didn't pipe() or
+ // If the user never called req.read(), and didn't pipe() or
// .resume() or .on('data'), then we call req._dump() so that the
// bytes will be pulled off the wire.
if (!req._consuming && !req._readableState.resumeScheduled)
diff --git a/lib/_stream_duplex.js b/lib/_stream_duplex.js
index 82cc23a38c..79c91cc362 100644
--- a/lib/_stream_duplex.js
+++ b/lib/_stream_duplex.js
@@ -67,7 +67,7 @@ function Duplex(options) {
}
Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -77,7 +77,7 @@ Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
});
Object.defineProperty(Duplex.prototype, 'writableBuffer', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -87,7 +87,7 @@ Object.defineProperty(Duplex.prototype, 'writableBuffer', {
});
Object.defineProperty(Duplex.prototype, 'writableLength', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -112,7 +112,7 @@ function onEndNT(self) {
}
Object.defineProperty(Duplex.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
diff --git a/lib/_stream_readable.js b/lib/_stream_readable.js
index fbab236203..8db8848ba1 100644
--- a/lib/_stream_readable.js
+++ b/lib/_stream_readable.js
@@ -79,7 +79,7 @@ function ReadableState(options, stream, isDuplex) {
if (typeof isDuplex !== 'boolean')
isDuplex = stream instanceof Stream.Duplex;
- // object stream flag. Used to make read(n) ignore n and to
+ // Object stream flag. Used to make read(n) ignore n and to
// make all the buffer merging and length checks go away
this.objectMode = !!options.objectMode;
@@ -109,7 +109,7 @@ function ReadableState(options, stream, isDuplex) {
// not happen before the first read call.
this.sync = true;
- // whenever we return null, then we set a flag to say
+ // Whenever we return null, then we set a flag to say
// that we're awaiting a 'readable' event emission.
this.needReadable = false;
this.emittedReadable = false;
@@ -172,7 +172,7 @@ function Readable(options) {
}
Object.defineProperty(Readable.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -323,7 +323,7 @@ Readable.prototype.setEncoding = function(enc) {
if (!StringDecoder)
StringDecoder = require('string_decoder').StringDecoder;
this._readableState.decoder = new StringDecoder(enc);
- // if setEncoding(null), decoder.encoding equals utf8
+ // If setEncoding(null), decoder.encoding equals utf8
this._readableState.encoding = this._readableState.decoder.encoding;
return this;
};
@@ -384,7 +384,7 @@ Readable.prototype.read = function(n) {
if (n !== 0)
state.emittedReadable = false;
- // if we're doing read(0) to trigger a readable event, but we
+ // If we're doing read(0) to trigger a readable event, but we
// already have a bunch of data in the buffer, then just trigger
// the 'readable' event and move on.
if (n === 0 &&
@@ -403,7 +403,7 @@ Readable.prototype.read = function(n) {
n = howMuchToRead(n, state);
- // if we've ended, and we're now clear, then finish it up.
+ // If we've ended, and we're now clear, then finish it up.
if (n === 0 && state.ended) {
if (state.length === 0)
endReadable(this);
@@ -506,12 +506,12 @@ function onEofChunk(stream, state) {
state.ended = true;
if (state.sync) {
- // if we are sync, wait until next tick to emit the data.
+ // If we are sync, wait until next tick to emit the data.
// Otherwise we risk emitting data in the flow()
// the readable code triggers during a read() call
emitReadable(stream);
} else {
- // emit 'readable' now to make sure it gets picked up.
+ // Emit 'readable' now to make sure it gets picked up.
state.needReadable = false;
if (!state.emittedReadable) {
state.emittedReadable = true;
@@ -656,7 +656,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
dest.end();
}
- // when the dest drains, it reduces the awaitDrain counter
+ // When the dest drains, it reduces the awaitDrain counter
// on the source. This would be more elegant with a .once()
// handler in flow(), but adding and removing repeatedly is
// too slow.
@@ -678,7 +678,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
cleanedUp = true;
- // if the reader is waiting for a drain event from this
+ // If the reader is waiting for a drain event from this
// specific writer, then it would cause it to never start
// flowing again.
// So, if this is awaiting a drain, then we just call it now.
@@ -708,8 +708,8 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
}
}
- // if the dest has an error, then stop piping into it.
- // however, don't suppress the throwing behavior for this.
+ // If the dest has an error, then stop piping into it.
+ // However, don't suppress the throwing behavior for this.
function onerror(er) {
debug('onerror', er);
unpipe();
@@ -828,7 +828,7 @@ Readable.prototype.on = function(ev, fn) {
const state = this._readableState;
if (ev === 'data') {
- // update readableListening so that resume() may be a no-op
+ // Update readableListening so that resume() may be a no-op
// a few lines down. This is needed to support once('readable').
state.readableListening = this.listenerCount('readable') > 0;
@@ -958,7 +958,7 @@ function flow(stream) {
while (state.flowing && stream.read() !== null);
}
-// wrap an old-style stream as the async data source.
+// Wrap an old-style stream as the async data source.
// This is *not* part of the readable stream interface.
// It is an ugly unfortunate mess of history.
Readable.prototype.wrap = function(stream) {
@@ -1011,7 +1011,7 @@ Readable.prototype.wrap = function(stream) {
stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
}
- // when we try to consume some more bytes, simply unpause the
+ // When we try to consume some more bytes, simply unpause the
// underlying stream.
this._read = (n) => {
debug('wrapped _read', n);
@@ -1034,7 +1034,7 @@ Readable.prototype[Symbol.asyncIterator] = function() {
};
Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -1044,7 +1044,7 @@ Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
});
Object.defineProperty(Readable.prototype, 'readableBuffer', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -1054,7 +1054,7 @@ Object.defineProperty(Readable.prototype, 'readableBuffer', {
});
Object.defineProperty(Readable.prototype, 'readableFlowing', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -1072,7 +1072,7 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', {
Readable._fromList = fromList;
Object.defineProperty(Readable.prototype, 'readableLength', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
diff --git a/lib/_stream_transform.js b/lib/_stream_transform.js
index d7fcb13395..9d8da0c547 100644
--- a/lib/_stream_transform.js
+++ b/lib/_stream_transform.js
@@ -88,7 +88,7 @@ function afterTransform(er, data) {
ts.writechunk = null;
ts.writecb = null;
- if (data != null) // single equals check for both `null` and `undefined`
+ if (data != null) // Single equals check for both `null` and `undefined`
this.push(data);
cb(er);
@@ -189,7 +189,7 @@ Transform.prototype._read = function(n) {
ts.transforming = true;
this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
} else {
- // mark that we need a transform, so that any data that comes in
+ // Mark that we need a transform, so that any data that comes in
// will get processed, now that we've asked for it.
ts.needTransform = true;
}
@@ -207,7 +207,7 @@ function done(stream, er, data) {
if (er)
return stream.emit('error', er);
- if (data != null) // single equals check for both `null` and `undefined`
+ if (data != null) // Single equals check for both `null` and `undefined`
stream.push(data);
// TODO(BridgeAR): Write a test for these two error cases
diff --git a/lib/_stream_writable.js b/lib/_stream_writable.js
index b317c208fb..570c4c4d0a 100644
--- a/lib/_stream_writable.js
+++ b/lib/_stream_writable.js
@@ -62,7 +62,7 @@ function WritableState(options, stream, isDuplex) {
if (typeof isDuplex !== 'boolean')
isDuplex = stream instanceof Stream.Duplex;
- // object stream flag to indicate whether or not this stream
+ // Object stream flag to indicate whether or not this stream
// contains buffers or objects.
this.objectMode = !!options.objectMode;
@@ -101,15 +101,15 @@ function WritableState(options, stream, isDuplex) {
// Everything else in the universe uses 'utf8', though.
this.defaultEncoding = options.defaultEncoding || 'utf8';
- // not an actual buffer we keep track of, but a measurement
+ // Not an actual buffer we keep track of, but a measurement
// of how much we're waiting to get pushed to some underlying
// socket or file.
this.length = 0;
- // a flag to see when we're in the middle of a write.
+ // A flag to see when we're in the middle of a write.
this.writing = false;
- // when true all writes will be buffered until .uncork() call
+ // When true all writes will be buffered until .uncork() call
this.corked = 0;
// A flag to be able to tell if the onwrite cb is called immediately,
@@ -129,7 +129,7 @@ function WritableState(options, stream, isDuplex) {
// The callback that the user supplies to write(chunk,encoding,cb)
this.writecb = null;
- // the amount that is being written when _write is called.
+ // The amount that is being written when _write is called.
this.writelen = 0;
this.bufferedRequest = null;
@@ -331,7 +331,7 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
};
Object.defineProperty(Writable.prototype, 'writableBuffer', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -350,7 +350,7 @@ function decodeChunk(state, chunk, encoding) {
}
Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -359,7 +359,7 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
}
});
-// if we're already writing something, then just put this
+// If we're already writing something, then just put this
// in the queue, and wait our turn. Otherwise, call _write
// If we return false, then we need a drain event, so set that flag.
function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
@@ -420,7 +420,7 @@ function onwriteError(stream, state, sync, er, cb) {
--state.pendingcb;
if (sync) {
- // defer the callback if we are being called synchronously
+ // Defer the callback if we are being called synchronously
// to avoid piling up things on the stack
process.nextTick(cb, er);
// this can emit finish, and it will always happen
@@ -496,7 +496,7 @@ function onwriteDrain(stream, state) {
}
}
-// if there's something in the buffer waiting, then process it
+// If there's something in the buffer waiting, then process it
function clearBuffer(stream, state) {
state.bufferProcessing = true;
var entry = state.bufferedRequest;
@@ -597,7 +597,7 @@ Writable.prototype.end = function(chunk, encoding, cb) {
};
Object.defineProperty(Writable.prototype, 'writableLength', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
@@ -686,7 +686,7 @@ function onCorkedFinish(corkReq, state, err) {
}
Object.defineProperty(Writable.prototype, 'destroyed', {
- // making it explicit this property is not enumerable
+ // Making it explicit this property is not enumerable
// because otherwise some prototype manipulation in
// userland will fail
enumerable: false,
diff --git a/lib/async_hooks.js b/lib/async_hooks.js
index 7d16070741..7ba5f40f18 100644
--- a/lib/async_hooks.js
+++ b/lib/async_hooks.js
@@ -157,7 +157,7 @@ class AsyncResource {
this[async_id_symbol] = newAsyncId();
this[trigger_async_id_symbol] = triggerAsyncId;
- // this prop name (destroyed) has to be synchronized with C++
+ // This prop name (destroyed) has to be synchronized with C++
this[destroyedSymbol] = { destroyed: false };
emitInit(
diff --git a/lib/dgram.js b/lib/dgram.js
index 08b6a4771a..4a9352b770 100644
--- a/lib/dgram.js
+++ b/lib/dgram.js
@@ -515,7 +515,7 @@ function doSend(ex, self, ip, list, address, port, callback) {
!!callback);
if (err && callback) {
- // don't emit as error, dgram_legacy.js compatibility
+ // Don't emit as error, dgram_legacy.js compatibility
const ex = exceptionWithHostPort(err, 'send', address, port);
process.nextTick(callback, ex);
}
diff --git a/lib/domain.js b/lib/domain.js
index 5db92e8432..da116e60b3 100644
--- a/lib/domain.js
+++ b/lib/domain.js
@@ -52,7 +52,7 @@ const pairing = new Map();
const asyncHook = createHook({
init(asyncId, type, triggerAsyncId, resource) {
if (process.domain !== null && process.domain !== undefined) {
- // if this operation is created while in a domain, let's mark it
+ // If this operation is created while in a domain, let's mark it
pairing.set(asyncId, process.domain);
resource.domain = process.domain;
}
@@ -180,7 +180,7 @@ exports.create = exports.createDomain = function createDomain() {
return new Domain();
};
-// the active domain is always the one that we're currently in.
+// The active domain is always the one that we're currently in.
exports.active = null;
Domain.prototype.members = undefined;
@@ -219,7 +219,7 @@ Domain.prototype._errorHandler = function(er) {
}
}
} else {
- // wrap this in a try/catch so we don't get infinite throwing
+ // Wrap this in a try/catch so we don't get infinite throwing
try {
// One of three things will happen here.
//
@@ -259,7 +259,7 @@ Domain.prototype._errorHandler = function(er) {
Domain.prototype.enter = function() {
- // note that this might be a no-op, but we still need
+ // Note that this might be a no-op, but we still need
// to push it onto the stack so that we can pop it later.
exports.active = process.domain = this;
stack.push(this);
@@ -268,7 +268,7 @@ Domain.prototype.enter = function() {
Domain.prototype.exit = function() {
- // don't do anything if this domain is not on the stack.
+ // Don't do anything if this domain is not on the stack.
var index = stack.lastIndexOf(this);
if (index === -1) return;
diff --git a/lib/events.js b/lib/events.js
index 3fce38f881..6c5b699faa 100644
--- a/lib/events.js
+++ b/lib/events.js
@@ -380,7 +380,7 @@ EventEmitter.prototype.removeAllListeners =
return this;
}
- // emit removeListener for all listeners on all events
+ // Emit removeListener for all listeners on all events
if (arguments.length === 0) {
var keys = Object.keys(events);
var key;
diff --git a/lib/fs.js b/lib/fs.js
index 873e93d9cd..f992166d54 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1269,7 +1269,7 @@ function appendFile(path, data, options, callback) {
// Don't make changes directly on options object
options = copyObject(options);
- // force append behavior when using a supplied file descriptor
+ // Force append behavior when using a supplied file descriptor
if (!options.flag || isFd(path))
options.flag = 'a';
@@ -1282,7 +1282,7 @@ function appendFileSync(path, data, options) {
// Don't make changes directly on options object
options = copyObject(options);
- // force append behavior when using a supplied file descriptor
+ // Force append behavior when using a supplied file descriptor
if (!options.flag || isFd(path))
options.flag = 'a';
@@ -1450,11 +1450,11 @@ function realpathSync(p, options) {
// current character position in p
let pos;
- // the partial path so far, including a trailing slash if any
+ // The partial path so far, including a trailing slash if any
let current;
// The partial path without a trailing slash (except when pointing at a root)
let base;
- // the partial path scanned in the previous round, with slash
+ // The partial path scanned in the previous round, with slash
let previous;
// Skip over roots
@@ -1590,11 +1590,11 @@ function realpath(p, options, callback) {
// current character position in p
let pos;
- // the partial path so far, including a trailing slash if any
+ // The partial path so far, including a trailing slash if any
let current;
// The partial path without a trailing slash (except when pointing at a root)
let base;
- // the partial path scanned in the previous round, with slash
+ // The partial path scanned in the previous round, with slash
let previous;
current = base = splitRoot(p);
diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js
index b8743c0a51..195cc156fc 100644
--- a/lib/internal/child_process.js
+++ b/lib/internal/child_process.js
@@ -105,7 +105,7 @@ const handleConversion = {
var firstTime = !this.channel.sockets.send[message.key];
var socketList = getSocketList('send', this, message.key);
- // the server should no longer expose a .connection property
+ // The server should no longer expose a .connection property
// and when asked to close it should query the socket status from
// the workers
if (firstTime) socket.server._setupWorker(socketList);
@@ -254,7 +254,7 @@ function ChildProcess() {
this.emit('exit', this.exitCode, this.signalCode);
}
- // if any of the stdio streams have not been touched,
+ // If any of the stdio streams have not been touched,
// then pull all the data through so that it can get the
// eof and emit a 'close' event.
// Do it on nextTick so that the user has one last chance
diff --git a/lib/internal/console/constructor.js b/lib/internal/console/constructor.js
index da54dd11a7..c2cf1fc48c 100644
--- a/lib/internal/console/constructor.js
+++ b/lib/internal/console/constructor.js
@@ -100,7 +100,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
optionsMap.set(this, inspectOptions);
}
- // bind the prototype functions to this Console instance
+ // Bind the prototype functions to this Console instance
var keys = Object.keys(Console.prototype);
for (var v = 0; v < keys.length; v++) {
var k = keys[v];
diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js
index 059f203597..98d256f696 100644
--- a/lib/internal/fs/streams.js
+++ b/lib/internal/fs/streams.js
@@ -40,17 +40,17 @@ function ReadStream(path, options) {
if (!(this instanceof ReadStream))
return new ReadStream(path, options);
- // a little bit bigger buffer and water marks by default
+ // A little bit bigger buffer and water marks by default
options = copyObject(getOptions(options, {}));
if (options.highWaterMark === undefined)
options.highWaterMark = 64 * 1024;
- // for backwards compat do not emit close on destroy.
+ // For backwards compat do not emit close on destroy.
options.emitClose = false;
Readable.call(this, options);
- // path will be ignored when fd is specified, so it can be falsy
+ // Path will be ignored when fd is specified, so it can be falsy
this.path = toPathIfFileURL(path);
this.fd = options.fd === undefined ? null : options.fd;
this.flags = options.flags === undefined ? 'r' : options.flags;
@@ -197,7 +197,7 @@ ReadStream.prototype._read = function(n) {
}
});
- // move the pool positions, and internal position for reading.
+ // Move the pool positions, and internal position for reading.
if (this.pos !== undefined)
this.pos += toRead;
pool.used += toRead;
@@ -238,12 +238,12 @@ function WriteStream(path, options) {
options = copyObject(getOptions(options, {}));
- // for backwards compat do not emit close on destroy.
+ // For backwards compat do not emit close on destroy.
options.emitClose = false;
Writable.call(this, options);
- // path will be ignored when fd is specified, so it can be falsy
+ // Path will be ignored when fd is specified, so it can be falsy
this.path = toPathIfFileURL(path);
this.fd = options.fd === undefined ? null : options.fd;
this.flags = options.flags === undefined ? 'w' : options.flags;
diff --git a/lib/internal/http2/compat.js b/lib/internal/http2/compat.js
index 1783a48ada..927504621d 100644
--- a/lib/internal/http2/compat.js
+++ b/lib/internal/http2/compat.js
@@ -440,7 +440,7 @@ class Http2ServerResponse extends Stream {
}
get socket() {
- // this is compatible with http1 which removes socket reference
+ // This is compatible with http1 which removes socket reference
// only from ServerResponse but not IncomingMessage
if (this[kState].closed)
return;
diff --git a/lib/internal/http2/core.js b/lib/internal/http2/core.js
index e27d529068..082bd552c2 100644
--- a/lib/internal/http2/core.js
+++ b/lib/internal/http2/core.js
@@ -564,7 +564,7 @@ function requestOnConnect(headers, options) {
if (options.waitForTrailers)
streamOptions |= STREAM_OPTION_GET_TRAILERS;
- // ret will be either the reserved stream ID (if positive)
+ // `ret` will be either the reserved stream ID (if positive)
// or an error code (if negative)
const ret = session[kHandle].request(headers,
streamOptions,
@@ -2082,7 +2082,7 @@ function startFilePipe(self, fd, offset, length) {
pipe.onunpipe = onFileUnpipe;
pipe.start();
- // exact length of the file doesn't matter here, since the
+ // Exact length of the file doesn't matter here, since the
// stream is closing anyway - just use 1 to signify that
// a write does exist
trackWriteState(self, 1);
diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js
index ee4fffa64a..b70171cc5d 100644
--- a/lib/internal/modules/cjs/loader.js
+++ b/lib/internal/modules/cjs/loader.js
@@ -219,7 +219,7 @@ function tryExtensions(p, exts, isMain) {
return false;
}
-// find the longest (possibly multi-dot) extension registered in
+// Find the longest (possibly multi-dot) extension registered in
// Module._extensions
function findLongestRegisteredExtension(filename) {
const name = path.basename(filename);
@@ -593,7 +593,7 @@ Module._resolveFilename = function(request, parent, isMain, options) {
paths = Module._resolveLookupPaths(request, parent, true);
}
- // look up the filename first, since that's the cache key.
+ // Look up the filename first, since that's the cache key.
var filename = Module._findPath(request, paths, isMain);
if (!filename) {
// eslint-disable-next-line no-restricted-syntax
@@ -692,7 +692,7 @@ Module.prototype._compile = function(content, filename) {
var inspectorWrapper = null;
if (process._breakFirstLine && process._eval == null) {
if (!resolvedArgv) {
- // we enter the repl if we're not given a filename argument.
+ // We enter the repl if we're not given a filename argument.
if (process.argv[1]) {
resolvedArgv = Module._resolveFilename(process.argv[1], null, false);
} else {
diff --git a/lib/internal/modules/esm/loader.js b/lib/internal/modules/esm/loader.js
index 820b593446..a1a1621909 100644
--- a/lib/internal/modules/esm/loader.js
+++ b/lib/internal/modules/esm/loader.js
@@ -25,11 +25,11 @@ const debug = require('util').debuglog('esm');
* the main module and everything in its dependency graph. */
class Loader {
constructor() {
- // methods which translate input code or other information
+ // Methods which translate input code or other information
// into es modules
this.translators = translators;
- // registry of loaded modules, akin to `require.cache`
+ // Registry of loaded modules, akin to `require.cache`
this.moduleMap = new ModuleMap();
// The resolver has the signature
diff --git a/lib/internal/process/next_tick.js b/lib/internal/process/next_tick.js
index 046449d658..cb0274367a 100644
--- a/lib/internal/process/next_tick.js
+++ b/lib/internal/process/next_tick.js
@@ -81,7 +81,7 @@ function setupNextTick(_setupNextTick, _setupPromises) {
class TickObject {
constructor(callback, args, triggerAsyncId) {
- // this must be set to null first to avoid function tracking
+ // This must be set to null first to avoid function tracking
// on the hidden class, revisit in V8 versions after 6.2
this.callback = null;
this.callback = callback;
diff --git a/lib/internal/process/stdio.js b/lib/internal/process/stdio.js
index 224af28b0f..5e9ff6b260 100644
--- a/lib/internal/process/stdio.js
+++ b/lib/internal/process/stdio.js
@@ -92,8 +92,8 @@ function getMainThreadStdio() {
// For supporting legacy API we put the FD here.
stdin.fd = fd;
- // stdin starts out life in a paused state, but node doesn't
- // know yet. Explicitly to readStop() it to put it in the
+ // `stdin` starts out life in a paused state, but node doesn't
+ // know yet. Explicitly to readStop() it to put it in the
// not-reading state.
if (stdin._handle && stdin._handle.readStop) {
stdin._handle.reading = false;
diff --git a/lib/internal/streams/destroy.js b/lib/internal/streams/destroy.js
index de6bcf9cdb..0c652be9dd 100644
--- a/lib/internal/streams/destroy.js
+++ b/lib/internal/streams/destroy.js
@@ -1,6 +1,6 @@
'use strict';
-// undocumented cb() API, needed for core, not for public API
+// Undocumented cb() API, needed for core, not for public API
function destroy(err, cb) {
const readableDestroyed = this._readableState &&
this._readableState.destroyed;
diff --git a/lib/internal/timers.js b/lib/internal/timers.js
index fc9979e4b5..3eb7192e2b 100644
--- a/lib/internal/timers.js
+++ b/lib/internal/timers.js
@@ -69,7 +69,7 @@ function Timeout(callback, after, args, isRepeat) {
this._idlePrev = this;
this._idleNext = this;
this._idleStart = null;
- // this must be set to null first to avoid function tracking
+ // This must be set to null first to avoid function tracking
// on the hidden class, revisit in V8 versions after 6.2
this._onTimeout = null;
this._onTimeout = callback;
diff --git a/lib/net.js b/lib/net.js
index 990fd7b5a1..011ccb6a53 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -311,7 +311,7 @@ function Socket(options) {
// handle strings directly
this._writableState.decodeStrings = false;
- // if we have a handle, then start the flow of data into the
+ // If we have a handle, then start the flow of data into the
// buffer. if not, then this will happen when we connect
if (this._handle && options.readable !== false) {
if (options.pauseOnCreate) {
@@ -343,7 +343,7 @@ Socket.prototype._unrefTimer = function _unrefTimer() {
};
-// the user has called .end(), and all the bytes have been
+// The user has called .end(), and all the bytes have been
// sent out to the other side.
Socket.prototype._final = function(cb) {
// If still connecting - defer handling `_final` until 'connect' will happen
@@ -453,7 +453,7 @@ Socket.prototype.setNoDelay = function(enable) {
return this;
}
- // backwards compatibility: assume true when `enable` is omitted
+ // Backwards compatibility: assume true when `enable` is omitted
if (this._handle.setNoDelay)
this._handle.setNoDelay(enable === undefined ? true : !!enable);
@@ -755,7 +755,7 @@ protoGetter('bytesWritten', function bytesWritten() {
});
if (Array.isArray(data)) {
- // was a writev, iterate over chunks to get total length
+ // Was a writev, iterate over chunks to get total length
for (var i = 0; i < data.length; i++) {
const chunk = data[i];
@@ -1147,7 +1147,7 @@ function toNumber(x) { return (x = Number(x)) >= 0 ? x : false; }
// Returns handle if it can be created, or error code if it can't
function createServerHandle(address, port, addressType, fd, flags) {
var err = 0;
- // assign handle in listen, and clean up if bind or listen fails
+ // Assign handle in listen, and clean up if bind or listen fails
var handle;
var isTCP = false;
diff --git a/lib/readline.js b/lib/readline.js
index c35bd1899b..9c7caff60a 100644
--- a/lib/readline.js
+++ b/lib/readline.js
@@ -134,7 +134,7 @@ function Interface(input, output, completer, terminal) {
throw new ERR_INVALID_OPT_VALUE.RangeError('historySize', historySize);
}
- // backwards compat; check the isTTY prop of the output stream
+ // Backwards compat; check the isTTY prop of the output stream
// when `terminal` was not specified
if (terminal === undefined && !(output === null || output === undefined)) {
terminal = !!output.isTTY;
@@ -441,7 +441,7 @@ Interface.prototype._normalWrite = function(b) {
if (newPartContainsEnding) {
this._sawReturnAt = string.endsWith('\r') ? Date.now() : 0;
- // got one or more newlines; process into "line" events
+ // Got one or more newlines; process into "line" events
var lines = string.split(lineEnding);
// Either '' or (conceivably) the unfinished portion of the next line
string = lines.pop();
@@ -449,7 +449,7 @@ Interface.prototype._normalWrite = function(b) {
for (var n = 0; n < lines.length; n++)
this._onLine(lines[n]);
} else if (string) {
- // no newlines this time, save what we have for next time
+ // No newlines this time, save what we have for next time
this._line_buffer = string;
}
};
@@ -869,7 +869,7 @@ Interface.prototype._ttyWrite = function(s, key) {
self.pause();
self.emit('SIGCONT');
}
- // explicitly re-enable "raw mode" and move the cursor to
+ // Explicitly re-enable "raw mode" and move the cursor to
// the correct position.
// See https://github.com/joyent/node/issues/3295.
self._setRawMode(true);
@@ -1078,7 +1078,7 @@ function emitKeypressEvents(stream, iface) {
);
}
} catch (err) {
- // if the generator throws (it could happen in the `keypress`
+ // If the generator throws (it could happen in the `keypress`
// event), we need to restart it.
stream[ESCAPE_DECODER] = emitKeys(stream);
stream[ESCAPE_DECODER].next();
diff --git a/lib/repl.js b/lib/repl.js
index dd675fc435..2d618d3d38 100644
--- a/lib/repl.js
+++ b/lib/repl.js
@@ -753,7 +753,7 @@ exports.REPLServer = REPLServer;
exports.REPL_MODE_SLOPPY = Symbol('repl-sloppy');
exports.REPL_MODE_STRICT = Symbol('repl-strict');
-// prompt is a string to print on each line for the prompt,
+// Prompt is a string to print on each line for the prompt,
// source is a stream to use for I/O, defaulting to stdin/stdout.
exports.start = function(prompt,
source,
@@ -1359,7 +1359,7 @@ function _memory(cmd) {
}());
}
- // it is possible to determine a syntax error at this point.
+ // It is possible to determine a syntax error at this point.
// if the REPL still has a bufferedCommand and
// self.lines.level.length === 0
// TODO? keep a log of level so that any syntax breaking lines can
diff --git a/lib/timers.js b/lib/timers.js
index 4f2fef449d..0937e73c4a 100644
--- a/lib/timers.js
+++ b/lib/timers.js
@@ -654,7 +654,7 @@ const Immediate = class Immediate {
constructor(callback, args) {
this._idleNext = null;
this._idlePrev = null;
- // this must be set to null first to avoid function tracking
+ // This must be set to null first to avoid function tracking
// on the hidden class, revisit in V8 versions after 6.2
this._onImmediate = null;
this._onImmediate = callback;
diff --git a/lib/url.js b/lib/url.js
index c34eee638c..9755cf430a 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -78,7 +78,7 @@ const hostPattern = /^\/\/[^@/]+@[^@/]+/;
const simplePathPattern = /^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/;
const hostnameMaxLen = 255;
-// protocols that can allow "unsafe" and "unwise" chars.
+// Protocols that can allow "unsafe" and "unwise" chars.
const unsafeProtocol = new SafeSet([
'javascript',
'javascript:'
@@ -434,7 +434,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
this.query = querystring.parse(this.query);
}
} else if (parseQueryString) {
- // no query string, but parseQueryString still requested
+ // No query string, but parseQueryString still requested
this.search = null;
this.query = Object.create(null);
}
@@ -863,7 +863,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
return result;
}
- // if a url ENDs in . or .., then it must get a trailing slash.
+ // If a url ENDs in . or .., then it must get a trailing slash.
// however, if it ends in anything else non-slashy,
// then it must NOT get a trailing slash.
var last = srcPath.slice(-1)[0];
@@ -871,7 +871,7 @@ Url.prototype.resolveObject = function resolveObject(relative) {
(result.host || relative.host || srcPath.length > 1) &&
(last === '.' || last === '..') || last === '');
- // strip single dots, resolve double dots to parent dir
+ // Strip single dots, resolve double dots to parent dir
// if the path tries to go above the root, `up` ends up > 0
var up = 0;
for (var i = srcPath.length - 1; i >= 0; i--) {