mirror of
https://github.com/nodejs/node.git
synced 2025-04-28 13:40:37 +00:00
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>
This commit is contained in:
parent
be3ae33936
commit
50dd555910
@ -60,9 +60,9 @@ module.exports = {
|
||||
'brace-style': ['error', '1tbs', { allowSingleLine: true }],
|
||||
'capitalized-comments': ['error', 'always', {
|
||||
line: {
|
||||
// Ignore all lines that have less characters than 62 and all lines that
|
||||
// Ignore all lines that have less characters than 50 and all lines that
|
||||
// start with something that looks like a variable name or code.
|
||||
ignorePattern: '^.{0,62}$|^ [a-z]+ ?[0-9A-Z_.(/=:-]',
|
||||
ignorePattern: '^.{0,50}$|^ [a-z]+ ?[0-9A-Z_.(/=:[#-]',
|
||||
ignoreInlineComments: true,
|
||||
ignoreConsecutiveComments: true
|
||||
},
|
||||
|
@ -40,7 +40,7 @@ class BenchmarkProgress {
|
||||
this.completedConfig = 0;
|
||||
// Total number of configurations for the current file
|
||||
this.scheduledConfig = 0;
|
||||
this.interval = 0; // result of setInterval for updating the elapsed time
|
||||
this.interval; // Updates the elapsed time.
|
||||
}
|
||||
|
||||
startQueue(index) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
// show the difference between calling a V8 binding C++ function
|
||||
// Show the difference between calling a V8 binding C++ function
|
||||
// relative to a comparable N-API C++ function,
|
||||
// in various types/numbers of arguments.
|
||||
// Reports n of calls per second.
|
||||
|
@ -1,4 +1,4 @@
|
||||
// show the difference between calling a short js function
|
||||
// Show the difference between calling a short js function
|
||||
// relative to a comparable C++ function.
|
||||
// Reports n of calls per second.
|
||||
// Note that JS speed goes up, while cxx speed stays about the same.
|
||||
|
@ -48,7 +48,7 @@ function main({ dur, len, type }) {
|
||||
socket.pipe(writer);
|
||||
|
||||
setTimeout(function() {
|
||||
// multiply by 2 since we're sending it first one way
|
||||
// Multiply by 2 since we're sending it first one way
|
||||
// then then back again.
|
||||
const bytes = writer.received * 2;
|
||||
const gbits = (bytes * 8) / (1024 * 1024 * 1024);
|
||||
|
@ -47,12 +47,12 @@ function main({ dur, len, type }) {
|
||||
}, dur * 1000);
|
||||
|
||||
clientHandle.onread = function(buffer) {
|
||||
// we're not expecting to ever get an EOF from the client.
|
||||
// just lots of data forever.
|
||||
// We're not expecting to ever get an EOF from the client.
|
||||
// Just lots of data forever.
|
||||
if (!buffer)
|
||||
fail('read');
|
||||
|
||||
// don't slice the buffer. the point of this is to isolate, not
|
||||
// Don't slice the buffer. The point of this is to isolate, not
|
||||
// simulate real traffic.
|
||||
bytes += buffer.byteLength;
|
||||
};
|
||||
|
@ -44,8 +44,8 @@ function main({ dur, len, type }) {
|
||||
fail(err, 'connect');
|
||||
|
||||
clientHandle.onread = function(buffer) {
|
||||
// we're not expecting to ever get an EOF from the client.
|
||||
// just lots of data forever.
|
||||
// We're not expecting to ever get an EOF from the client.
|
||||
// Just lots of data forever.
|
||||
if (!buffer)
|
||||
fail('read');
|
||||
|
||||
@ -105,7 +105,7 @@ function main({ dur, len, type }) {
|
||||
clientHandle.readStart();
|
||||
|
||||
setTimeout(function() {
|
||||
// multiply by 2 since we're sending it first one way
|
||||
// Multiply by 2 since we're sending it first one way
|
||||
// then then back again.
|
||||
bench.end(2 * (bytes * 8) / (1024 * 1024 * 1024));
|
||||
process.exit(0);
|
||||
|
@ -110,12 +110,12 @@ function main({ dur, len, type }) {
|
||||
connectReq.oncomplete = function() {
|
||||
var bytes = 0;
|
||||
clientHandle.onread = function(buffer) {
|
||||
// we're not expecting to ever get an EOF from the client.
|
||||
// just lots of data forever.
|
||||
// We're not expecting to ever get an EOF from the client.
|
||||
// Just lots of data forever.
|
||||
if (!buffer)
|
||||
fail('read');
|
||||
|
||||
// don't slice the buffer. the point of this is to isolate, not
|
||||
// Don't slice the buffer. The point of this is to isolate, not
|
||||
// simulate real traffic.
|
||||
bytes += buffer.byteLength;
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ function makeConnection() {
|
||||
|
||||
function done() {
|
||||
running = false;
|
||||
// it's only an established connection if they both saw it.
|
||||
// It's only an established connection if they both saw it.
|
||||
// because we destroy the server somewhat abruptly, these
|
||||
// don't always match. Generally, serverConn will be
|
||||
// the smaller number, but take the min just to be sure.
|
||||
|
@ -69,7 +69,7 @@ function before(asyncId) { }
|
||||
// After is called just after the resource's callback has finished.
|
||||
function after(asyncId) { }
|
||||
|
||||
// destroy is called when an AsyncWrap instance is destroyed.
|
||||
// Destroy is called when an AsyncWrap instance is destroyed.
|
||||
function destroy(asyncId) { }
|
||||
|
||||
// promiseResolve is called only for promise resources, when the
|
||||
|
@ -322,7 +322,7 @@ if (cluster.isMaster) {
|
||||
|
||||
process.on('message', (msg) => {
|
||||
if (msg === 'shutdown') {
|
||||
// initiate graceful close of any connections to server
|
||||
// Initiate graceful close of any connections to server
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ const serverDomain = domain.create();
|
||||
serverDomain.run(() => {
|
||||
// server is created in the scope of serverDomain
|
||||
http.createServer((req, res) => {
|
||||
// req and res are also created in the scope of serverDomain
|
||||
// Req and res are also created in the scope of serverDomain
|
||||
// however, we'd prefer to have a separate domain for each request.
|
||||
// create it first thing, and add req and res to it.
|
||||
const reqd = domain.create();
|
||||
@ -316,7 +316,7 @@ const d = domain.create();
|
||||
|
||||
function readSomeFile(filename, cb) {
|
||||
fs.readFile(filename, 'utf8', d.bind((er, data) => {
|
||||
// if this throws, it will also be passed to the domain
|
||||
// If this throws, it will also be passed to the domain
|
||||
return cb(er, data ? JSON.parse(data) : null);
|
||||
}));
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ export async function dynamicInstantiate(url) {
|
||||
return {
|
||||
exports: ['customExportName'],
|
||||
execute: (exports) => {
|
||||
// get and set functions provided for pre-allocated export names
|
||||
// Get and set functions provided for pre-allocated export names
|
||||
exports.customExportName.set('value');
|
||||
}
|
||||
};
|
||||
|
@ -641,7 +641,7 @@ const logFnWrapper = listeners[0];
|
||||
// Logs "log once" to the console and does not unbind the `once` event
|
||||
logFnWrapper.listener();
|
||||
|
||||
// logs "log once" to the console and removes the listener
|
||||
// Logs "log once" to the console and removes the listener
|
||||
logFnWrapper();
|
||||
|
||||
emitter.on('log', () => console.log('log persistently'));
|
||||
|
@ -299,7 +299,7 @@ path.join('/foo', 'bar', 'baz/asdf', 'quux', '..');
|
||||
// Returns: '/foo/bar/baz/asdf'
|
||||
|
||||
path.join('foo', {}, 'bar');
|
||||
// throws 'TypeError: Path must be a string. Received {}'
|
||||
// Throws 'TypeError: Path must be a string. Received {}'
|
||||
```
|
||||
|
||||
A [`TypeError`][] is thrown if any of the path segments is not a string.
|
||||
@ -495,7 +495,7 @@ path.resolve('/foo/bar', '/tmp/file/');
|
||||
// Returns: '/tmp/file'
|
||||
|
||||
path.resolve('wwwroot', 'static_files/png/', '../gif/image.gif');
|
||||
// if the current working directory is /home/myself/node,
|
||||
// If the current working directory is /home/myself/node,
|
||||
// this returns '/home/myself/node/wwwroot/static_files/gif/image.gif'
|
||||
```
|
||||
|
||||
|
@ -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'] });
|
||||
|
||||
|
@ -118,8 +118,8 @@ that implements an HTTP server:
|
||||
const http = require('http');
|
||||
|
||||
const server = http.createServer((req, res) => {
|
||||
// req is an http.IncomingMessage, which is a Readable Stream
|
||||
// res is an http.ServerResponse, which is a Writable Stream
|
||||
// `req` is an http.IncomingMessage, which is a Readable Stream
|
||||
// `res` is an http.ServerResponse, which is a Writable Stream
|
||||
|
||||
let body = '';
|
||||
// Get the data as utf8 strings.
|
||||
@ -1195,7 +1195,7 @@ function parseHeader(stream, callback) {
|
||||
stream.removeListener('readable', onReadable);
|
||||
if (buf.length)
|
||||
stream.unshift(buf);
|
||||
// now the body of the message can be read from the stream.
|
||||
// Now the body of the message can be read from the stream.
|
||||
callback(null, header, stream);
|
||||
} else {
|
||||
// still reading the header.
|
||||
@ -1930,7 +1930,7 @@ pause/resume mechanism, and a data callback, the low-level source can be wrapped
|
||||
by the custom `Readable` instance:
|
||||
|
||||
```js
|
||||
// source is an object with readStop() and readStart() methods,
|
||||
// `_source` is an object with readStop() and readStart() methods,
|
||||
// and an `ondata` member that gets called when it has data, and
|
||||
// an `onend` member that gets called when the data is over.
|
||||
|
||||
@ -1938,11 +1938,11 @@ class SourceWrapper extends Readable {
|
||||
constructor(options) {
|
||||
super(options);
|
||||
|
||||
this._source = getLowlevelSourceObject();
|
||||
this._source = getLowLevelSourceObject();
|
||||
|
||||
// Every time there's data, push it into the internal buffer.
|
||||
this._source.ondata = (chunk) => {
|
||||
// if push() returns false, then stop reading from source
|
||||
// If push() returns false, then stop reading from source
|
||||
if (!this.push(chunk))
|
||||
this._source.readStop();
|
||||
};
|
||||
@ -2391,7 +2391,7 @@ For example, consider the following code:
|
||||
// WARNING! BROKEN!
|
||||
net.createServer((socket) => {
|
||||
|
||||
// we add an 'end' listener, but never consume the data
|
||||
// We add an 'end' listener, but never consume the data
|
||||
socket.on('end', () => {
|
||||
// It will never get here.
|
||||
socket.end('The message was received but was not processed.\n');
|
||||
|
@ -133,7 +133,7 @@ t2.enable();
|
||||
// Prints 'node,node.perf,v8'
|
||||
console.log(trace_events.getEnabledCategories());
|
||||
|
||||
t2.disable(); // will only disable emission of the 'node.perf' category
|
||||
t2.disable(); // Will only disable emission of the 'node.perf' category
|
||||
|
||||
// Prints 'node,v8'
|
||||
console.log(trace_events.getEnabledCategories());
|
||||
|
@ -33,7 +33,7 @@ const sandbox = { x: 2 };
|
||||
vm.createContext(sandbox); // Contextify the sandbox.
|
||||
|
||||
const code = 'x += 40; var y = 17;';
|
||||
// x and y are global variables in the sandboxed environment.
|
||||
// `x` and `y` are global variables in the sandboxed environment.
|
||||
// Initially, x has the value 2 because that is the value of sandbox.x.
|
||||
vm.runInContext(code, sandbox);
|
||||
|
||||
|
@ -81,7 +81,7 @@ request.on('response', (response) => {
|
||||
const output = fs.createWriteStream('example.com_index.html');
|
||||
|
||||
switch (response.headers['content-encoding']) {
|
||||
// or, just use zlib.createUnzip() to handle both cases
|
||||
// Or, just use zlib.createUnzip() to handle both cases
|
||||
case 'gzip':
|
||||
response.pipe(zlib.createGunzip()).pipe(output);
|
||||
break;
|
||||
|
@ -397,7 +397,7 @@ const options = {
|
||||
flags: ['--zero-fill-buffers']
|
||||
};
|
||||
|
||||
// main and configs are required, options is optional.
|
||||
// `main` and `configs` are required, `options` is optional.
|
||||
const bench = common.createBenchmark(main, configs, options);
|
||||
|
||||
// Note that any code outside main will be run twice,
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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,
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
@ -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,
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
12
lib/fs.js
12
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);
|
||||
|
@ -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
|
||||
|
@ -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];
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
10
lib/net.js
10
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;
|
||||
|
@ -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();
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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--) {
|
||||
|
@ -80,7 +80,7 @@ assert.ok(!arg);
|
||||
assert.strictEqual(signal, null);
|
||||
} else {
|
||||
assert.strictEqual(code, null);
|
||||
// most posix systems will show 'SIGABRT', but alpine34 does not
|
||||
// Most posix systems will show 'SIGABRT', but alpine34 does not
|
||||
if (signal !== 'SIGABRT') {
|
||||
console.log(`parent received signal ${signal}\nchild's stderr:`);
|
||||
console.log(stderr);
|
||||
|
@ -15,7 +15,7 @@ const hooks = initHooks();
|
||||
hooks.enable();
|
||||
dns.lookup('www.google.com', 4, common.mustCall(onlookup));
|
||||
function onlookup() {
|
||||
// we don't care about the error here in order to allow
|
||||
// We don't care about the error here in order to allow
|
||||
// tests to run offline (lookup will fail in that case and the err be set);
|
||||
|
||||
const as = hooks.activitiesOfTypes('GETADDRINFOREQWRAP');
|
||||
|
@ -15,7 +15,7 @@ const hooks = initHooks();
|
||||
hooks.enable();
|
||||
dns.lookupService('127.0.0.1', 80, common.mustCall(onlookupService));
|
||||
function onlookupService() {
|
||||
// we don't care about the error here in order to allow
|
||||
// We don't care about the error here in order to allow
|
||||
// tests to run offline (lookup will fail in that case and the err be set)
|
||||
|
||||
const as = hooks.activitiesOfTypes('GETNAMEINFOREQWRAP');
|
||||
|
@ -11,7 +11,7 @@ const dns = require('dns');
|
||||
const hooks = initHooks();
|
||||
|
||||
hooks.enable();
|
||||
// uses cares for queryA which in turn uses QUERYWRAP
|
||||
// Uses cares for queryA which in turn uses QUERYWRAP
|
||||
dns.resolve('localhost', common.mustCall(onresolved));
|
||||
|
||||
function onresolved() {
|
||||
|
@ -21,7 +21,7 @@ function onlistening() {
|
||||
Buffer.alloc(2), 0, 2, sock.address().port,
|
||||
undefined, common.mustCall(onsent));
|
||||
|
||||
// init not called synchronously because dns lookup always wraps
|
||||
// Init not called synchronously because dns lookup always wraps
|
||||
// callback in a next tick even if no lookup is needed
|
||||
// TODO (trevnorris) submit patch to fix creation of tick objects and instead
|
||||
// create the send wrap synchronously.
|
||||
|
@ -14,7 +14,7 @@ function findInGraph(graph, type, n) {
|
||||
}
|
||||
|
||||
function pruneTickObjects(activities) {
|
||||
// remove one TickObject on each pass until none is left anymore
|
||||
// Remove one TickObject on each pass until none is left anymore
|
||||
// not super efficient, but simplest especially to handle
|
||||
// multiple TickObjects in a row
|
||||
let foundTickObject = true;
|
||||
@ -31,7 +31,7 @@ function pruneTickObjects(activities) {
|
||||
if (tickObjectIdx >= 0) {
|
||||
foundTickObject = true;
|
||||
|
||||
// point all triggerAsyncIds that point to the tickObject
|
||||
// Point all triggerAsyncIds that point to the tickObject
|
||||
// to its triggerAsyncId and finally remove it from the activities
|
||||
const tickObject = activities[tickObjectIdx];
|
||||
const newTriggerId = tickObject.triggerAsyncId;
|
||||
@ -48,7 +48,7 @@ function pruneTickObjects(activities) {
|
||||
module.exports = function verifyGraph(hooks, graph) {
|
||||
pruneTickObjects(hooks);
|
||||
|
||||
// map actual ids to standin ids defined in the graph
|
||||
// Map actual ids to standin ids defined in the graph
|
||||
const idtouid = {};
|
||||
const uidtoid = {};
|
||||
const typeSeen = {};
|
||||
|
@ -78,7 +78,7 @@ if (process.env.NODE_TEST_WITH_ASYNC_HOOKS) {
|
||||
const async_wrap = internalBinding('async_wrap');
|
||||
|
||||
process.on('exit', () => {
|
||||
// iterate through handles to make sure nothing crashes
|
||||
// Iterate through handles to make sure nothing crashes
|
||||
for (const k in initHandles)
|
||||
util.inspect(initHandles[k]);
|
||||
});
|
||||
@ -777,7 +777,7 @@ module.exports = {
|
||||
// use external command
|
||||
opensslCli = 'openssl';
|
||||
} else {
|
||||
// use command built from sources included in Node.js repository
|
||||
// Use command built from sources included in Node.js repository
|
||||
opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli');
|
||||
}
|
||||
|
||||
|
@ -44,7 +44,7 @@ assert.strictEqual(test_object.readonlyAccessor2, 2);
|
||||
assert.throws(() => { test_object.readonlyAccessor2 = 3; },
|
||||
/^TypeError: Cannot assign to read only property 'readonlyAccessor2' of object '#<MyObject>'$/);
|
||||
|
||||
// validate that static properties are on the class as opposed
|
||||
// Validate that static properties are on the class as opposed
|
||||
// to the instance
|
||||
assert.strictEqual(TestConstructor.staticReadonlyAccessor1, 10);
|
||||
assert.strictEqual(test_object.staticReadonlyAccessor1, undefined);
|
||||
|
@ -4,7 +4,7 @@ const fs = require('fs');
|
||||
const common = require('../../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// addon is referenced through the eval expression in testFile
|
||||
// Addon is referenced through the eval expression in testFile
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const addon = require(`./build/${common.buildType}/test_general`);
|
||||
const path = require('path');
|
||||
|
@ -3,7 +3,7 @@
|
||||
const common = require('../../common');
|
||||
const assert = require('assert');
|
||||
|
||||
// addon is referenced through the eval expression in testFile
|
||||
// `addon` is referenced through the eval expression in testFile
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
const addon = require(`./build/${common.buildType}/test_general`);
|
||||
|
||||
|
@ -41,7 +41,7 @@ server.listen(
|
||||
res.on('error', (err) => assert.fail(err));
|
||||
res.socket.on('error', (err) => assert.fail(err));
|
||||
res.resume();
|
||||
// drain the socket and wait for it to be free to reuse
|
||||
// Drain the socket and wait for it to be free to reuse
|
||||
res.socket.once('free', () => {
|
||||
// This is the pain point. Internally the Agent will call
|
||||
// `socket._handle.asyncReset()` and if the _handle does not implement
|
||||
|
@ -84,7 +84,7 @@ const outOfRangeError = {
|
||||
type: RangeError
|
||||
};
|
||||
|
||||
// try to write a 0-length string beyond the end of b
|
||||
// Try to write a 0-length string beyond the end of b
|
||||
common.expectsError(() => b.write('', 2048), outOfBoundsError);
|
||||
|
||||
// throw when writing to negative offset
|
||||
@ -96,14 +96,14 @@ common.expectsError(() => b.write('a', 2048), outOfBoundsError);
|
||||
// throw when writing to negative offset
|
||||
common.expectsError(() => b.write('a', -1), outOfBoundsError);
|
||||
|
||||
// try to copy 0 bytes worth of data into an empty buffer
|
||||
// Try to copy 0 bytes worth of data into an empty buffer
|
||||
b.copy(Buffer.alloc(0), 0, 0, 0);
|
||||
|
||||
// try to copy 0 bytes past the end of the target buffer
|
||||
// Try to copy 0 bytes past the end of the target buffer
|
||||
b.copy(Buffer.alloc(0), 1, 1, 1);
|
||||
b.copy(Buffer.alloc(1), 1, 1, 1);
|
||||
|
||||
// try to copy 0 bytes from past the end of the source buffer
|
||||
// Try to copy 0 bytes from past the end of the source buffer
|
||||
b.copy(Buffer.alloc(1), 0, 2048, 2048);
|
||||
|
||||
// Testing for smart defaults and ability to pass string values as offset
|
||||
@ -183,7 +183,7 @@ Buffer.alloc(1).write('', 1, 0);
|
||||
}
|
||||
|
||||
{
|
||||
// make sure only top level parent propagates from allocPool
|
||||
// Make sure only top level parent propagates from allocPool
|
||||
const b = Buffer.allocUnsafe(5);
|
||||
const c = b.slice(0, 4);
|
||||
const d = c.slice(0, 2);
|
||||
@ -331,13 +331,13 @@ assert.strictEqual((Buffer.from('Man')).toString('base64'), 'TWFu');
|
||||
assert.strictEqual(quote.length, bytesWritten);
|
||||
assert.strictEqual(quote, b.toString('ascii', 0, quote.length));
|
||||
|
||||
// check that the base64 decoder on the constructor works
|
||||
// Check that the base64 decoder on the constructor works
|
||||
// even in the presence of whitespace.
|
||||
b = Buffer.from(expectedWhite, 'base64');
|
||||
assert.strictEqual(quote.length, b.length);
|
||||
assert.strictEqual(quote, b.toString('ascii', 0, quote.length));
|
||||
|
||||
// check that the base64 decoder ignores illegal chars
|
||||
// Check that the base64 decoder ignores illegal chars
|
||||
const expectedIllegal = expected.slice(0, 60) + ' \x80' +
|
||||
expected.slice(60, 120) + ' \xff' +
|
||||
expected.slice(120, 180) + ' \x00' +
|
||||
@ -723,7 +723,7 @@ assert.strictEqual(x.inspect(), '<Buffer 81 a3 66 6f 6f a3 62 61 72>');
|
||||
}
|
||||
|
||||
{
|
||||
// test unmatched surrogates not producing invalid utf8 output
|
||||
// Test unmatched surrogates not producing invalid utf8 output
|
||||
// ef bf bd = utf-8 representation of unicode replacement character
|
||||
// see https://codereview.chromium.org/121173009/
|
||||
const buf = Buffer.from('ab\ud800cd', 'utf8');
|
||||
|
@ -78,7 +78,7 @@ assert.strictEqual(Buffer.byteLength('𠝹𠱓𠱸', 'UTF8'), 12);
|
||||
assert.strictEqual(Buffer.byteLength('hey there'), 9);
|
||||
assert.strictEqual(Buffer.byteLength('𠱸挶νξ#xx :)'), 17);
|
||||
assert.strictEqual(Buffer.byteLength('hello world', ''), 11);
|
||||
// it should also be assumed with unrecognized encoding
|
||||
// It should also be assumed with unrecognized encoding
|
||||
assert.strictEqual(Buffer.byteLength('hello world', 'abc'), 11);
|
||||
assert.strictEqual(Buffer.byteLength('ßœ∑≈', 'unkn0wn enc0ding'), 10);
|
||||
|
||||
|
@ -48,7 +48,7 @@ let cntr = 0;
|
||||
}
|
||||
|
||||
{
|
||||
// copy longer buffer b to shorter c without targetStart
|
||||
// Copy longer buffer b to shorter c without targetStart
|
||||
b.fill(++cntr);
|
||||
c.fill(++cntr);
|
||||
const copied = b.copy(c);
|
||||
@ -73,7 +73,7 @@ let cntr = 0;
|
||||
}
|
||||
|
||||
{
|
||||
// try to copy 513 bytes, and check we don't overrun c
|
||||
// Try to copy 513 bytes, and check we don't overrun c
|
||||
b.fill(++cntr);
|
||||
c.fill(++cntr);
|
||||
const copied = b.copy(c, 0, 0, 513);
|
||||
@ -94,7 +94,7 @@ let cntr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// copy string longer than buffer length (failure will segfault)
|
||||
// Copy string longer than buffer length (failure will segfault)
|
||||
const bb = Buffer.allocUnsafe(10);
|
||||
bb.fill('hello crazy world');
|
||||
|
||||
@ -121,7 +121,7 @@ common.expectsError(
|
||||
common.expectsError(
|
||||
() => b.copy(c, 0, -1), errorProperty);
|
||||
|
||||
// when sourceStart is greater than sourceEnd, zero copied
|
||||
// When sourceStart is greater than sourceEnd, zero copied
|
||||
assert.strictEqual(b.copy(c, 0, 100, 10), 0);
|
||||
|
||||
// when targetStart > targetLength, zero copied
|
||||
|
@ -193,7 +193,7 @@ for (let i = 66; i < 76; i++) { // from 'B' to 'K'
|
||||
|
||||
const longBufferString = Buffer.from(longString);
|
||||
|
||||
// pattern of 15 chars, repeated every 16 chars in long
|
||||
// Pattern of 15 chars, repeated every 16 chars in long
|
||||
let pattern = 'ABACABADABACABA';
|
||||
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
|
||||
const includes = longBufferString.includes(pattern, i);
|
||||
|
@ -248,7 +248,7 @@ for (let i = 66; i < 76; i++) { // from 'B' to 'K'
|
||||
|
||||
const longBufferString = Buffer.from(longString);
|
||||
|
||||
// pattern of 15 chars, repeated every 16 chars in long
|
||||
// Pattern of 15 chars, repeated every 16 chars in long
|
||||
let pattern = 'ABACABADABACABA';
|
||||
for (let i = 0; i < longBufferString.length - pattern.length; i += 7) {
|
||||
const index = longBufferString.indexOf(pattern, i);
|
||||
|
@ -32,7 +32,7 @@ read(buf, 'readInt16LE', [1], 0x48fd);
|
||||
read(buf, 'readInt32BE', [1], -45552945);
|
||||
read(buf, 'readInt32LE', [1], -806729475);
|
||||
|
||||
// testing basic functionality of readIntBE() and readIntLE()
|
||||
// Testing basic functionality of readIntBE() and readIntLE()
|
||||
read(buf, 'readIntBE', [1, 1], -3);
|
||||
read(buf, 'readIntLE', [2, 1], 0x48);
|
||||
|
||||
@ -47,7 +47,7 @@ read(buf, 'readUInt16LE', [2], 0xea48);
|
||||
read(buf, 'readUInt32BE', [1], 0xfd48eacf);
|
||||
read(buf, 'readUInt32LE', [1], 0xcfea48fd);
|
||||
|
||||
// testing basic functionality of readUIntBE() and readUIntLE()
|
||||
// Testing basic functionality of readUIntBE() and readUIntLE()
|
||||
read(buf, 'readUIntBE', [2, 2], 0x48ea);
|
||||
read(buf, 'readUIntLE', [2, 2], 0xea48);
|
||||
|
||||
|
@ -43,7 +43,7 @@ try {
|
||||
assert.strictEqual(SlowBuffer('6').length, 6);
|
||||
assert.strictEqual(SlowBuffer(true).length, 1);
|
||||
|
||||
// should create zero-length buffer if parameter is not a number
|
||||
// Should create zero-length buffer if parameter is not a number
|
||||
assert.strictEqual(SlowBuffer().length, 0);
|
||||
assert.strictEqual(SlowBuffer(NaN).length, 0);
|
||||
assert.strictEqual(SlowBuffer({}).length, 0);
|
||||
|
@ -5,7 +5,7 @@ const assert = require('assert');
|
||||
|
||||
const rangeBuffer = Buffer.from('abc');
|
||||
|
||||
// if start >= buffer's length, empty string will be returned
|
||||
// If start >= buffer's length, empty string will be returned
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', 3), '');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', +Infinity), '');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', 3.14, 3), '');
|
||||
@ -25,7 +25,7 @@ assert.strictEqual(rangeBuffer.toString('ascii', '-1', 3), 'abc');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', '-1.99', 3), 'abc');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', '-Infinity', 3), 'abc');
|
||||
|
||||
// if start is an invalid integer, start will be taken as zero
|
||||
// If start is an invalid integer, start will be taken as zero
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', 'node.js', 3), 'abc');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', {}, 3), 'abc');
|
||||
assert.strictEqual(rangeBuffer.toString('ascii', [], 3), 'abc');
|
||||
|
@ -48,7 +48,7 @@ if (process.argv[2] === 'child') {
|
||||
socket.end((process.connected).toString());
|
||||
});
|
||||
|
||||
// when the socket is closed, we will close the server
|
||||
// When the socket is closed, we will close the server
|
||||
// allowing the process to self terminate
|
||||
socket.on('end', function() {
|
||||
server.close();
|
||||
@ -77,14 +77,14 @@ if (process.argv[2] === 'child') {
|
||||
parentFlag = child.connected;
|
||||
}));
|
||||
|
||||
// the process should also self terminate without using signals
|
||||
// The process should also self terminate without using signals
|
||||
child.on('exit', common.mustCall());
|
||||
|
||||
// when child is listening
|
||||
child.on('message', function(obj) {
|
||||
if (obj && obj.msg === 'ready') {
|
||||
|
||||
// connect to child using TCP to know if disconnect was emitted
|
||||
// Connect to child using TCP to know if disconnect was emitted
|
||||
const socket = net.connect(obj.port);
|
||||
|
||||
socket.on('data', function(data) {
|
||||
|
@ -8,7 +8,7 @@ const _validateStdio = require('internal/child_process')._validateStdio;
|
||||
const expectedError =
|
||||
common.expectsError({ code: 'ERR_INVALID_OPT_VALUE', type: TypeError }, 2);
|
||||
|
||||
// should throw if string and not ignore, pipe, or inherit
|
||||
// Should throw if string and not ignore, pipe, or inherit
|
||||
assert.throws(() => _validateStdio('foo'), expectedError);
|
||||
|
||||
// should throw if not a string or array
|
||||
|
@ -12,8 +12,8 @@ const syntaxArgs = [
|
||||
['--check']
|
||||
];
|
||||
|
||||
// should not execute code piped from stdin with --check
|
||||
// loop each possible option, `-c` or `--check`
|
||||
// Should not execute code piped from stdin with --check.
|
||||
// Loop each possible option, `-c` or `--check`.
|
||||
syntaxArgs.forEach(function(args) {
|
||||
const stdin = 'throw new Error("should not get run");';
|
||||
const c = spawnSync(node, args, { encoding: 'utf8', input: stdin });
|
||||
|
@ -68,7 +68,7 @@ if (cluster.isWorker) {
|
||||
}
|
||||
};
|
||||
|
||||
// start two workers and execute callback when both is listening
|
||||
// Start two workers and execute callback when both is listening
|
||||
const startCluster = (cb) => {
|
||||
const workers = 8;
|
||||
let online = 0;
|
||||
|
@ -45,7 +45,7 @@ if (cluster.isMaster && process.argv.length !== 3) {
|
||||
worker.on('online', common.mustCall());
|
||||
|
||||
worker.on('message', common.mustCall(function(err) {
|
||||
// disconnect first, so that we will not leave zombies
|
||||
// Disconnect first, so that we will not leave zombies
|
||||
worker.disconnect();
|
||||
assert.strictEqual(err.code, 'EADDRINUSE');
|
||||
}));
|
||||
@ -54,7 +54,7 @@ if (cluster.isMaster && process.argv.length !== 3) {
|
||||
const PIPE_NAME = process.env.PIPE_NAME;
|
||||
const cp = fork(__filename, [PIPE_NAME], { stdio: 'inherit' });
|
||||
|
||||
// message from the child indicates it's ready and listening
|
||||
// Message from the child indicates it's ready and listening
|
||||
cp.on('message', common.mustCall(function() {
|
||||
const server = net.createServer().listen(PIPE_NAME, function() {
|
||||
// message child process so that it can exit
|
||||
|
@ -68,7 +68,7 @@ if (cluster.isMaster) {
|
||||
});
|
||||
} else {
|
||||
process.on('message', function(msg) {
|
||||
// we shouldn't exit, not while a network connection exists
|
||||
// We shouldn't exit, not while a network connection exists
|
||||
net.connect(msg.port);
|
||||
});
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ if (cluster.isWorker) {
|
||||
socket.on('connect', function() {
|
||||
socket.on('data', function() {
|
||||
console.log('got data from client');
|
||||
// socket definitely connected to worker if we got data
|
||||
// Socket definitely connected to worker if we got data
|
||||
worker.disconnect();
|
||||
socket.end();
|
||||
});
|
||||
|
@ -149,7 +149,7 @@ console.trace('This is a %j %d', { formatted: 'trace' }, 10, 'foo');
|
||||
console.time('label');
|
||||
console.timeEnd('label');
|
||||
|
||||
// verify that Object.prototype properties can be used as labels
|
||||
// Verify that Object.prototype properties can be used as labels
|
||||
console.time('__proto__');
|
||||
console.timeEnd('__proto__');
|
||||
console.time('constructor');
|
||||
@ -202,7 +202,7 @@ assert.strictEqual(errStrings.length, process.stderr.writeTimes);
|
||||
restoreStdout();
|
||||
restoreStderr();
|
||||
|
||||
// verify that console.timeEnd() doesn't leave dead links
|
||||
// Verify that console.timeEnd() doesn't leave dead links
|
||||
const timesMapSize = console._times.size;
|
||||
console.time('label1');
|
||||
console.time('label2');
|
||||
@ -268,7 +268,7 @@ assert.strictEqual(strings.length, 0);
|
||||
assert.strictEqual(errStrings.shift().split('\n').shift(),
|
||||
'Trace: This is a {"formatted":"trace"} 10 foo');
|
||||
|
||||
// hijack stderr to catch `process.emitWarning` which is using
|
||||
// Hijack stderr to catch `process.emitWarning` which is using
|
||||
// `process.nextTick`
|
||||
hijackStderr(common.mustCall(function(data) {
|
||||
restoreStderr();
|
||||
|
@ -153,7 +153,7 @@ for (const test of TEST_CASES) {
|
||||
msg += decrypt.final(outputEncoding);
|
||||
assert.strictEqual(msg, test.plain);
|
||||
} else {
|
||||
// assert that final throws if input data could not be verified!
|
||||
// Assert that final throws if input data could not be verified!
|
||||
assert.throws(function() { decrypt.final('hex'); }, errMessages.auth);
|
||||
}
|
||||
}
|
||||
@ -192,7 +192,7 @@ for (const test of TEST_CASES) {
|
||||
msg += decrypt.final('ascii');
|
||||
assert.strictEqual(msg, test.plain);
|
||||
} else {
|
||||
// assert that final throws if input data could not be verified!
|
||||
// Assert that final throws if input data could not be verified!
|
||||
assert.throws(function() { decrypt.final('ascii'); }, errMessages.auth);
|
||||
}
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ testCipher2(Buffer.from('0123456789abcdef'));
|
||||
assert.strictEqual(decipher.setAAD(aadbuf), decipher);
|
||||
}
|
||||
|
||||
// error throwing in setAAD/setAuthTag/getAuthTag/setAutoPadding
|
||||
// Error throwing in setAAD/setAuthTag/getAuthTag/setAutoPadding
|
||||
{
|
||||
const key = '0123456789';
|
||||
const aadbuf = Buffer.from('aadbuf');
|
||||
|
@ -33,7 +33,7 @@ const crypto = require('crypto');
|
||||
|
||||
const EXTERN_APEX = 0xFBEE9;
|
||||
|
||||
// manually controlled string for checking binary output
|
||||
// Manually controlled string for checking binary output
|
||||
let ucs2_control = 'a\u0000';
|
||||
|
||||
// grow the strings to proper length
|
||||
|
@ -235,7 +235,7 @@ assert.throws(function() {
|
||||
// Then open private_key.pem and change its header and footer.
|
||||
const sha1_privateKey = fixtures.readSync('test_bad_rsa_privkey.pem',
|
||||
'ascii');
|
||||
// this would inject errors onto OpenSSL's error stack
|
||||
// This would inject errors onto OpenSSL's error stack
|
||||
crypto.createSign('sha1').sign(sha1_privateKey);
|
||||
}, (err) => {
|
||||
// Throws crypto error, so there is an opensslErrorStack property.
|
||||
|
@ -16,7 +16,7 @@ socket.on('listening', function() {
|
||||
// get a random port for send
|
||||
const portGetter = dgram.createSocket('udp4')
|
||||
.bind(0, 'localhost', common.mustCall(() => {
|
||||
// adds a listener to 'listening' to send the data when
|
||||
// Adds a listener to 'listening' to send the data when
|
||||
// the socket is available
|
||||
socket.send(buf, 0, buf.length,
|
||||
portGetter.address().port,
|
||||
|
@ -13,7 +13,7 @@ const portGetter = dgram.createSocket('udp4')
|
||||
portGetter.address().port,
|
||||
portGetter.address().address);
|
||||
|
||||
// if close callback is not function, ignore the argument.
|
||||
// If close callback is not function, ignore the argument.
|
||||
socket.close('bad argument');
|
||||
portGetter.close();
|
||||
|
||||
|
@ -23,6 +23,6 @@ d.run(common.mustCall(() => {
|
||||
}));
|
||||
|
||||
setTimeout(common.mustCall(() => {
|
||||
// escape from the domain, but implicit is still bound to it.
|
||||
// Escape from the domain, but implicit is still bound to it.
|
||||
implicit.emit('error', new Error('foobar'));
|
||||
}), 1);
|
||||
|
@ -40,7 +40,7 @@ d.on('error', common.mustCall(function(er) {
|
||||
}));
|
||||
|
||||
|
||||
// implicit handling of thrown errors while in a domain, via the
|
||||
// Implicit handling of thrown errors while in a domain, via the
|
||||
// single entry points of ReqWrap and MakeCallback. Even if
|
||||
// we try very hard to escape, there should be no way to, even if
|
||||
// we go many levels deep through timeouts and multiple IO calls.
|
||||
|
@ -36,7 +36,7 @@ const server = http.createServer((req, res) => {
|
||||
const b = domain.create();
|
||||
a.add(b);
|
||||
|
||||
// treat these EE objects as if they are a part of the b domain
|
||||
// Treat these EE objects as if they are a part of the b domain
|
||||
// so, an 'error' event on them propagates to the domain, rather
|
||||
// than being thrown.
|
||||
b.add(req);
|
||||
|
@ -39,7 +39,7 @@ const data = '南越国是前203年至前111年存在于岭南地区的一个国
|
||||
const tmpdir = require('../common/tmpdir');
|
||||
tmpdir.refresh();
|
||||
|
||||
// test that empty file will be created and have content added
|
||||
// Test that empty file will be created and have content added
|
||||
const filename = join(tmpdir.path, 'append-sync.txt');
|
||||
|
||||
fs.appendFileSync(filename, data);
|
||||
|
@ -68,7 +68,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
.catch(throwNextTick);
|
||||
}
|
||||
|
||||
// test that appends data to a non-empty file (callback API)
|
||||
// Test that appends data to a non-empty file (callback API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-non-empty.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -84,7 +84,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
}));
|
||||
}
|
||||
|
||||
// test that appends data to a non-empty file (promise API)
|
||||
// Test that appends data to a non-empty file (promise API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-non-empty-promise.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -98,7 +98,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
.catch(throwNextTick);
|
||||
}
|
||||
|
||||
// test that appendFile accepts buffers (callback API)
|
||||
// Test that appendFile accepts buffers (callback API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-buffer.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -115,7 +115,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
}));
|
||||
}
|
||||
|
||||
// test that appendFile accepts buffers (promises API)
|
||||
// Test that appendFile accepts buffers (promises API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-buffer-promises.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -130,7 +130,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
.catch(throwNextTick);
|
||||
}
|
||||
|
||||
// test that appendFile accepts numbers (callback API)
|
||||
// Test that appendFile accepts numbers (callback API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-numbers.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -153,7 +153,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
}));
|
||||
}
|
||||
|
||||
// test that appendFile accepts numbers (promises API)
|
||||
// Test that appendFile accepts numbers (promises API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-numbers-promises.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -176,7 +176,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
.catch(throwNextTick);
|
||||
}
|
||||
|
||||
// test that appendFile accepts file descriptors (callback API)
|
||||
// Test that appendFile accepts file descriptors (callback API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-descriptors.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
@ -200,7 +200,7 @@ const throwNextTick = (e) => { process.nextTick(() => { throw e; }); };
|
||||
}));
|
||||
}
|
||||
|
||||
// test that appendFile accepts file descriptors (promises API)
|
||||
// Test that appendFile accepts file descriptors (promises API)
|
||||
{
|
||||
const filename = join(tmpdir.path, 'append-descriptors-promises.txt');
|
||||
fs.writeFileSync(filename, currentFileData);
|
||||
|
@ -10,7 +10,7 @@ const tempFile = path.join(tmpdir.path, 'fs-non-number-arguments-throw');
|
||||
tmpdir.refresh();
|
||||
fs.writeFileSync(tempFile, 'abc\ndef');
|
||||
|
||||
// a sanity check when using numbers instead of strings
|
||||
// A sanity check when using numbers instead of strings
|
||||
const sanity = 'def';
|
||||
const saneEmitter = fs.createReadStream(tempFile, { start: 4, end: 6 });
|
||||
|
||||
|
@ -148,8 +148,8 @@ check(null, fs.watch, fileUrl2, assert.fail);
|
||||
check(null, fs.watchFile, fileUrl2, assert.fail);
|
||||
check(fs.writeFile, fs.writeFileSync, fileUrl2, 'abc');
|
||||
|
||||
// an 'error' for exists means that it doesn't exist.
|
||||
// one of many reasons why this file is the absolute worst.
|
||||
// An 'error' for exists means that it doesn't exist.
|
||||
// One of many reasons why this file is the absolute worst.
|
||||
fs.exists('foo\u0000bar', common.mustCall((exists) => {
|
||||
assert(!exists);
|
||||
}));
|
||||
|
@ -25,10 +25,10 @@ async function validateFilePermission() {
|
||||
const newPermissions = 0o765;
|
||||
|
||||
if (common.isWindows) {
|
||||
// chmod in Windows will only toggle read only/write access. the
|
||||
// Chmod in Windows will only toggle read only/write access. The
|
||||
// fs.Stats.mode in Windows is computed using read/write
|
||||
// bits (not exec). read only at best returns 444; r/w 666.
|
||||
// refer: /deps/uv/src/win/fs.cfs;
|
||||
// bits (not exec). Read-only at best returns 444; r/w 666.
|
||||
// Refer: /deps/uv/src/win/fs.cfs;
|
||||
expectedAccess = 0o664;
|
||||
} else {
|
||||
expectedAccess = newPermissions;
|
||||
|
@ -106,7 +106,7 @@ async function getHandle(dest) {
|
||||
await handle.sync();
|
||||
}
|
||||
|
||||
// test fs.read promises when length to read is zero bytes
|
||||
// Test fs.read promises when length to read is zero bytes
|
||||
{
|
||||
const dest = path.resolve(tmpDir, 'test1.js');
|
||||
const handle = await getHandle(dest);
|
||||
|
@ -25,7 +25,7 @@ for (i = 0; i < driveLetters.length; ++i) {
|
||||
if (i === driveLetters.length)
|
||||
common.skip('Cannot create subst drive');
|
||||
|
||||
// schedule cleanup (and check if all callbacks where called)
|
||||
// Schedule cleanup (and check if all callbacks where called)
|
||||
process.on('exit', function() {
|
||||
spawnSync('subst', ['/d', drive]);
|
||||
});
|
||||
|
@ -115,7 +115,7 @@ function test_simple_relative_symlink(realpath, realpathSync, callback) {
|
||||
function test_simple_absolute_symlink(realpath, realpathSync, callback) {
|
||||
console.log('test_simple_absolute_symlink');
|
||||
|
||||
// this one should still run, even if skipSymlinks is set,
|
||||
// This one should still run, even if skipSymlinks is set,
|
||||
// because it uses a junction.
|
||||
const type = skipSymlinks ? 'junction' : 'dir';
|
||||
|
||||
@ -418,7 +418,7 @@ function test_up_multiple(realpath, realpathSync, cb) {
|
||||
function test_abs_with_kids(realpath, realpathSync, cb) {
|
||||
console.log('test_abs_with_kids');
|
||||
|
||||
// this one should still run, even if skipSymlinks is set,
|
||||
// This one should still run, even if skipSymlinks is set,
|
||||
// because it uses a junction.
|
||||
const type = skipSymlinks ? 'junction' : 'dir';
|
||||
|
||||
|
@ -195,7 +195,7 @@ if (!process.arch.includes('arm') && !common.isOpenBSD && !common.isSunOS) {
|
||||
}
|
||||
|
||||
if (common.isWindows) {
|
||||
// this value would get converted to (double)1713037251359.9998
|
||||
// This value would get converted to (double)1713037251359.9998
|
||||
const truncate_mtime = 1713037251360;
|
||||
fs.utimesSync(path, truncate_mtime / 1000, truncate_mtime / 1000);
|
||||
const truncate_stats = fs.statSync(path);
|
||||
|
@ -42,7 +42,7 @@ common.expectsError(
|
||||
|
||||
// pct-encoded characters in the path will be decoded and checked
|
||||
if (common.isWindows) {
|
||||
// encoded back and forward slashes are not permitted on windows
|
||||
// Encoded back and forward slashes are not permitted on windows
|
||||
['%2f', '%2F', '%5c', '%5C'].forEach((i) => {
|
||||
common.expectsError(
|
||||
() => {
|
||||
@ -67,7 +67,7 @@ if (common.isWindows) {
|
||||
}
|
||||
);
|
||||
} else {
|
||||
// encoded forward slashes are not permitted on other platforms
|
||||
// Encoded forward slashes are not permitted on other platforms
|
||||
['%2f', '%2F'].forEach((i) => {
|
||||
common.expectsError(
|
||||
() => {
|
||||
|
@ -107,4 +107,4 @@ const { kStateSymbol } = require('internal/dgram');
|
||||
}
|
||||
|
||||
|
||||
// see also test/pseudo-tty/test-handle-wrap-isrefed-tty.js
|
||||
// See also test/pseudo-tty/test-handle-wrap-isrefed-tty.js
|
||||
|
@ -8,7 +8,7 @@ require('../common');
|
||||
const assert = require('assert');
|
||||
const agent = require('http').globalAgent;
|
||||
|
||||
// small stub just so we can call addRequest directly
|
||||
// Small stub just so we can call addRequest directly
|
||||
const req = {
|
||||
getHeader: () => {}
|
||||
};
|
||||
|
@ -52,7 +52,7 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
// assert request2 was removed from the queue
|
||||
assert(!agent.requests[key]);
|
||||
process.nextTick(() => {
|
||||
// assert that the same socket was not assigned to request2,
|
||||
// Assert that the same socket was not assigned to request2,
|
||||
// since it was destroyed.
|
||||
assert.notStrictEqual(request1.socket, request2.socket);
|
||||
assert(!request2.socket.destroyed, 'the socket is destroyed');
|
||||
@ -64,7 +64,7 @@ const server = http.createServer(common.mustCall((req, res) => {
|
||||
const request2 = http.get(requestOptions, common.mustCall((response) => {
|
||||
assert(!request2.socket.destroyed);
|
||||
assert(request1.socket.destroyed);
|
||||
// assert not reusing the same socket, since it was destroyed.
|
||||
// Assert not reusing the same socket, since it was destroyed.
|
||||
assert.notStrictEqual(request1.socket, request2.socket);
|
||||
const countdown = new Countdown(2, () => server.close());
|
||||
request2.socket.on('close', common.mustCall(() => countdown.dec()));
|
||||
|
@ -50,7 +50,7 @@ server.listen(common.PIPE, function() {
|
||||
sched(function() { req.end(); }, 5);
|
||||
});
|
||||
|
||||
// schedule a callback after `ticks` event loop ticks
|
||||
// Schedule a callback after `ticks` event loop ticks
|
||||
function sched(cb, ticks) {
|
||||
function fn() {
|
||||
if (--ticks)
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user