diff options
Diffstat (limited to 'lib/internal')
-rw-r--r-- | lib/internal/child_process.js | 2 | ||||
-rw-r--r-- | lib/internal/freeze_intrinsics.js | 16 | ||||
-rw-r--r-- | lib/internal/fs/streams.js | 4 | ||||
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 4 | ||||
-rw-r--r-- | lib/internal/modules/esm/translators.js | 2 | ||||
-rw-r--r-- | lib/internal/process/per_thread.js | 6 | ||||
-rw-r--r-- | lib/internal/readline.js | 4 | ||||
-rw-r--r-- | lib/internal/streams/async_iterator.js | 23 | ||||
-rw-r--r-- | lib/internal/timers.js | 2 | ||||
-rw-r--r-- | lib/internal/trace_events_async_hooks.js | 2 | ||||
-rw-r--r-- | lib/internal/url.js | 8 |
11 files changed, 35 insertions, 38 deletions
diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index dddfd7cbec..390feef96a 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -565,7 +565,7 @@ function setupChannel(target, channel) { // Object where socket lists will live channel.sockets = { got: {}, send: {} }; - // handlers will go through this + // Handlers will go through this target.on('internalMessage', function(message, handle) { // Once acknowledged - continue sending handles. if (message.cmd === 'NODE_HANDLE_ACK' || diff --git a/lib/internal/freeze_intrinsics.js b/lib/internal/freeze_intrinsics.js index effac31853..5d58121a25 100644 --- a/lib/internal/freeze_intrinsics.js +++ b/lib/internal/freeze_intrinsics.js @@ -14,7 +14,7 @@ // limitations under the License. // SPDX-License-Identifier: MIT -// based upon: +// Based upon: // https://github.com/google/caja/blob/master/src/com/google/caja/ses/startSES.js // https://github.com/google/caja/blob/master/src/com/google/caja/ses/repairES5.js // https://github.com/tc39/proposal-frozen-realms/blob/91ac390e3451da92b5c27e354b39e52b7636a437/shim/src/deep-freeze.js @@ -176,11 +176,11 @@ module.exports = function() { // NB: handle for any new cases in future } if (frozenSet.has(val) || freezingSet.has(val)) { - // todo use uncurried form + // TODO: Use uncurried form // Ignore if already frozen or freezing return; } - freezingSet.add(val); // todo use uncurried form + freezingSet.add(val); // TODO: Use uncurried form } function doFreeze(obj) { @@ -201,8 +201,8 @@ module.exports = function() { const descs = getOwnPropertyDescriptors(obj); enqueue(proto); ownKeys(descs).forEach((name) => { - // todo uncurried form - // todo: getOwnPropertyDescriptors is guaranteed to return well-formed + // TODO: Uncurried form + // TODO: getOwnPropertyDescriptors is guaranteed to return well-formed // descriptors, but they still inherit from Object.prototype. If // someone has poisoned Object.prototype to add 'value' or 'get' // properties, then a simple 'if ("value" in desc)' or 'desc.value' @@ -222,12 +222,12 @@ module.exports = function() { function dequeue() { // New values added before forEach() has finished will be visited. - freezingSet.forEach(doFreeze); // todo curried forEach + freezingSet.forEach(doFreeze); // TODO: Curried forEach } function commit() { - // todo curried forEach - // we capture the real WeakSet.prototype.add above, in case someone + // TODO: Curried forEach + // We capture the real WeakSet.prototype.add above, in case someone // changes it. The two-argument form of forEach passes the second // argument as the 'this' binding, so we add to the correct set. freezingSet.forEach(frozenSet.add, frozenSet); diff --git a/lib/internal/fs/streams.js b/lib/internal/fs/streams.js index b057ddb9bd..24c79dffb5 100644 --- a/lib/internal/fs/streams.js +++ b/lib/internal/fs/streams.js @@ -121,7 +121,7 @@ ReadStream.prototype.open = function() { this.fd = fd; this.emit('open', fd); this.emit('ready'); - // start the flow of data. + // Start the flow of data. this.read(); }); }; @@ -137,7 +137,7 @@ ReadStream.prototype._read = function(n) { return; if (!pool || pool.length - pool.used < kMinPoolSpace) { - // discard the old pool. + // Discard the old pool. allocNewPool(this.readableHighWaterMark); } diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index f205b47a4a..b7486db6e4 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -711,7 +711,7 @@ Module.prototype.load = function(filename) { const module = ESMLoader.moduleMap.get(url); // Create module entry at load time to snapshot exports correctly const exports = this.exports; - if (module !== undefined) { // called from cjs translator + if (module !== undefined) { // Called from cjs translator module.reflect.onReady((reflect) => { reflect.exports.default.set(exports); }); @@ -885,7 +885,7 @@ if (experimentalModules) { }; } -// bootstrap main module. +// Bootstrap main module. Module.runMain = function() { // Load the main module--the command line argument. if (experimentalModules) { diff --git a/lib/internal/modules/esm/translators.js b/lib/internal/modules/esm/translators.js index 97a7f4a2f3..de09910872 100644 --- a/lib/internal/modules/esm/translators.js +++ b/lib/internal/modules/esm/translators.js @@ -86,7 +86,7 @@ translators.set('cjs', async (url, isMain) => { // through normal resolution translators.set('builtin', async (url) => { debug(`Translating BuiltinModule ${url}`); - // slice 'node:' scheme + // Slice 'node:' scheme const id = url.slice(5); const module = NativeModule.map.get(id); if (!module) { diff --git a/lib/internal/process/per_thread.js b/lib/internal/process/per_thread.js index 5706d560ba..7d2e83100c 100644 --- a/lib/internal/process/per_thread.js +++ b/lib/internal/process/per_thread.js @@ -167,7 +167,7 @@ function wrapProcessMethods(binding) { throw new ERR_INVALID_ARG_TYPE('pid', 'number', pid); } - // preserve null signal + // Preserve null signal if (sig === (sig | 0)) { // XXX(joyeecheung): we have to use process._kill here because // it's monkey-patched by tests. @@ -268,12 +268,12 @@ function buildAllowedFlags() { } delete() { - // noop, `Set` API compatible + // No-op, `Set` API compatible return false; } clear() { - // noop + // No-op } has(key) { diff --git a/lib/internal/readline.js b/lib/internal/readline.js index b05c2d575a..a561194297 100644 --- a/lib/internal/readline.js +++ b/lib/internal/readline.js @@ -186,7 +186,7 @@ function* emitKeys(stream) { } if (escaped && (ch === 'O' || ch === '[')) { - // ansi escape sequence + // ANSI escape sequence let code = ch; let modifier = 0; @@ -407,7 +407,7 @@ function* emitKeys(stream) { key.name = String.fromCharCode(ch.charCodeAt(0) + 'a'.charCodeAt(0) - 1); key.ctrl = true; } else if (/^[0-9A-Za-z]$/.test(ch)) { - // letter, number, shift+letter + // Letter, number, shift+letter key.name = ch.toLowerCase(); key.shift = /^[A-Z]$/.test(ch); key.meta = escaped; diff --git a/lib/internal/streams/async_iterator.js b/lib/internal/streams/async_iterator.js index 0d22e4efee..16d1316b16 100644 --- a/lib/internal/streams/async_iterator.js +++ b/lib/internal/streams/async_iterator.js @@ -18,9 +18,7 @@ function readAndResolve(iter) { const resolve = iter[kLastResolve]; if (resolve !== null) { const data = iter[kStream].read(); - // we defer if data is null - // we can be expecting either 'end' or - // 'error' + // We defer if data is null. We can be expecting either 'end' or 'error'. if (data !== null) { iter[kLastPromise] = null; iter[kLastResolve] = null; @@ -32,7 +30,7 @@ function readAndResolve(iter) { function onReadable(iter) { // We wait for the next tick, because it might - // emit an error with process.nextTick + // emit an error with `process.nextTick()`. process.nextTick(readAndResolve, iter); } @@ -59,7 +57,7 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ next() { // If we have detected an error in the meanwhile - // reject straight away + // reject straight away. const error = this[kError]; if (error !== null) { return Promise.reject(error); @@ -110,9 +108,9 @@ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({ }, return() { - // destroy(err, cb) is a private API - // we can guarantee we have that here, because we control the - // Readable class this is attached to + // destroy(err, cb) is a private API. + // We can guarantee we have that here, because we control the + // Readable class this is attached to. return new Promise((resolve, reject) => { this[kStream].destroy(null, (err) => { if (err) { @@ -135,9 +133,8 @@ const createReadableStreamAsyncIterator = (stream) => { value: stream._readableState.endEmitted, writable: true }, - // The function passed to new Promise - // is cached so we avoid allocating a new - // closure at every run + // The function passed to new Promise is cached so we avoid allocating a new + // closure at every run. [kHandlePromise]: { value: (resolve, reject) => { const data = iterator[kStream].read(); @@ -159,8 +156,8 @@ const createReadableStreamAsyncIterator = (stream) => { finished(stream, (err) => { if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { const reject = iterator[kLastReject]; - // Reject if we are waiting for data in the Promise - // returned by next() and store the error + // Reject if we are waiting for data in the Promise returned by next() and + // store the error. if (reject !== null) { iterator[kLastPromise] = null; iterator[kLastResolve] = null; diff --git a/lib/internal/timers.js b/lib/internal/timers.js index d485c3ff65..9a1b0dea0b 100644 --- a/lib/internal/timers.js +++ b/lib/internal/timers.js @@ -154,7 +154,7 @@ function initAsyncResource(resource, type) { // Timer constructor function. // The entire prototype is defined in lib/timers.js function Timeout(callback, after, args, isRepeat) { - after *= 1; // coalesce to number or NaN + after *= 1; // Coalesce to number or NaN if (!(after >= 1 && after <= TIMEOUT_MAX)) { if (after > TIMEOUT_MAX) { process.emitWarning(`${after} does not fit into` + diff --git a/lib/internal/trace_events_async_hooks.js b/lib/internal/trace_events_async_hooks.js index 05bb7b8564..3b69a85fab 100644 --- a/lib/internal/trace_events_async_hooks.js +++ b/lib/internal/trace_events_async_hooks.js @@ -60,7 +60,7 @@ function createHook() { trace(kEndEvent, kTraceEventCategory, type, asyncId); - // cleanup asyncId to type map + // Cleanup asyncId to type map typeMemory.delete(asyncId); } }); diff --git a/lib/internal/url.js b/lib/internal/url.js index 95f0fc21e5..9bbd80148c 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -136,7 +136,7 @@ class URLSearchParams { throw new ERR_ARG_NOT_ITERABLE('Query pairs'); } - // sequence<sequence<USVString>> + // Sequence<sequence<USVString>> // Note: per spec we have to first exhaust the lists then process them const pairs = []; for (const pair of init) { @@ -159,7 +159,7 @@ class URLSearchParams { this[searchParams].push(pair[0], pair[1]); } } else { - // record<USVString, USVString> + // Record<USVString, USVString> // Need to use reflection APIs for full spec compliance. this[searchParams] = []; const keys = Reflect.ownKeys(init); @@ -230,7 +230,7 @@ function onParseComplete(flags, protocol, username, password, ctx.query = query; ctx.fragment = fragment; ctx.host = host; - if (!this[searchParams]) { // invoked from URL constructor + if (!this[searchParams]) { // Invoked from URL constructor this[searchParams] = new URLSearchParams(); this[searchParams][context] = this; } @@ -455,7 +455,7 @@ Object.defineProperties(URL.prototype, { try { return (new URL(ctx.path[0])).origin; } catch { - // fall through... do nothing + // Fall through... do nothing } } return kOpaqueOrigin; |