diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/_http_agent.js | 4 | ||||
-rw-r--r-- | lib/_http_client.js | 2 | ||||
-rw-r--r-- | lib/_http_common.js | 4 | ||||
-rw-r--r-- | lib/buffer.js | 10 | ||||
-rw-r--r-- | lib/child_process.js | 14 | ||||
-rw-r--r-- | lib/dgram.js | 2 | ||||
-rw-r--r-- | lib/fs.js | 4 | ||||
-rw-r--r-- | lib/fs/promises.js | 4 | ||||
-rw-r--r-- | lib/internal/modules/cjs/loader.js | 2 | ||||
-rw-r--r-- | lib/internal/url.js | 12 | ||||
-rw-r--r-- | lib/querystring.js | 12 | ||||
-rw-r--r-- | lib/url.js | 56 | ||||
-rw-r--r-- | lib/util.js | 2 |
13 files changed, 65 insertions, 63 deletions
diff --git a/lib/_http_agent.js b/lib/_http_agent.js index 5a18e40b4f..303f56bfe4 100644 --- a/lib/_http_agent.js +++ b/lib/_http_agent.js @@ -134,8 +134,8 @@ Agent.prototype.getName = function getName(options) { return name; }; -Agent.prototype.addRequest = function addRequest(req, options, port/*legacy*/, - localAddress/*legacy*/) { +Agent.prototype.addRequest = function addRequest(req, options, port/* legacy */, + localAddress/* legacy */) { // Legacy API: addRequest(req, host, port, localAddress) if (typeof options === 'string') { options = { diff --git a/lib/_http_client.js b/lib/_http_client.js index 5ab6d0bdba..a7df01bbf4 100644 --- a/lib/_http_client.js +++ b/lib/_http_client.js @@ -194,7 +194,7 @@ function ClientRequest(options, cb) { var posColon = hostHeader.indexOf(':'); if (posColon !== -1 && hostHeader.indexOf(':', posColon + 1) !== -1 && - hostHeader.charCodeAt(0) !== 91/*'['*/) { + hostHeader.charCodeAt(0) !== 91/* '[' */) { hostHeader = `[${hostHeader}]`; } diff --git a/lib/_http_common.js b/lib/_http_common.js index ffb90407c6..b101c11911 100644 --- a/lib/_http_common.js +++ b/lib/_http_common.js @@ -237,7 +237,7 @@ const tokenRegExp = /^[\^_`a-zA-Z\-0-9!#$%&'*+.|~]+$/; * Verifies that the given val is a valid HTTP token * per the rules defined in RFC 7230 * See https://tools.ietf.org/html/rfc7230#section-3.2.6 -**/ + */ function checkIsHttpToken(val) { return tokenRegExp.test(val); } @@ -248,7 +248,7 @@ const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; * field-value = *( field-content / obs-fold ) * field-content = field-vchar [ 1*( SP / HTAB ) field-vchar ] * field-vchar = VCHAR / obs-text - **/ + */ function checkInvalidHeaderChar(val) { return headerCharRegex.test(val); } diff --git a/lib/buffer.js b/lib/buffer.js index 45c1282f2d..09afc4d713 100644 --- a/lib/buffer.js +++ b/lib/buffer.js @@ -170,7 +170,7 @@ const doFlaggedDeprecation = * runtime deprecation would introduce too much breakage at this time. It's not * likely that the Buffer constructors would ever actually be removed. * Deprecation Code: DEP0005 - **/ + */ function Buffer(arg, encodingOrOffset, length) { doFlaggedDeprecation(); // Common case. @@ -196,7 +196,7 @@ Object.defineProperty(Buffer, Symbol.species, { * Buffer.from(array) * Buffer.from(buffer) * Buffer.from(arrayBuffer[, byteOffset[, length]]) - **/ + */ Buffer.from = function from(value, encodingOrOffset, length) { if (typeof value === 'string') return fromString(value, encodingOrOffset); @@ -260,7 +260,7 @@ function assertSize(size) { /** * Creates a new filled Buffer instance. * alloc(size[, fill[, encoding]]) - **/ + */ Buffer.alloc = function alloc(size, fill, encoding) { assertSize(size); if (fill !== undefined && size > 0) { @@ -272,7 +272,7 @@ Buffer.alloc = function alloc(size, fill, encoding) { /** * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer * instance. If `--zero-fill-buffers` is set, will zero-fill the buffer. - **/ + */ Buffer.allocUnsafe = function allocUnsafe(size) { assertSize(size); return allocate(size); @@ -282,7 +282,7 @@ Buffer.allocUnsafe = function allocUnsafe(size) { * Equivalent to SlowBuffer(num), by default creates a non-zero-filled * Buffer instance that is not allocated off the pre-initialized pool. * If `--zero-fill-buffers` is set, will zero-fill the buffer. - **/ + */ Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) { assertSize(size); return createUnsafeBuffer(size); diff --git a/lib/child_process.js b/lib/child_process.js index 97b436cc07..ee3752a817 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -59,7 +59,7 @@ function stdioStringToArray(option) { } } -exports.fork = function(modulePath /*, args, options*/) { +exports.fork = function(modulePath /* , args, options */) { // Get options and args arguments. var execArgv; @@ -143,7 +143,7 @@ function normalizeExecArgs(command, options, callback) { } -exports.exec = function(command /*, options, callback*/) { +exports.exec = function(command /* , options, callback */) { var opts = normalizeExecArgs.apply(null, arguments); return exports.execFile(opts.file, opts.options, @@ -172,7 +172,7 @@ Object.defineProperty(exports.exec, util.promisify.custom, { value: customPromiseExecFunction(exports.exec) }); -exports.execFile = function(file /*, args, options, callback*/) { +exports.execFile = function(file /* , args, options, callback */) { var args = []; var callback; var options = { @@ -511,7 +511,7 @@ function normalizeSpawnArguments(file, args, options) { } -var spawn = exports.spawn = function(/*file, args, options*/) { +var spawn = exports.spawn = function(/* file, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var options = opts.options; var child = new ChildProcess(); @@ -534,7 +534,7 @@ var spawn = exports.spawn = function(/*file, args, options*/) { return child; }; -function spawnSync(/*file, args, options*/) { +function spawnSync(/* file, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var options = opts.options; @@ -602,7 +602,7 @@ function checkExecSyncError(ret, args, cmd) { } -function execFileSync(/*command, args, options*/) { +function execFileSync(/* command, args, options */) { var opts = normalizeSpawnArguments.apply(null, arguments); var inheritStderr = !opts.options.stdio; @@ -621,7 +621,7 @@ function execFileSync(/*command, args, options*/) { exports.execFileSync = execFileSync; -function execSync(command /*, options*/) { +function execSync(command /* , options */) { var opts = normalizeExecArgs.apply(null, arguments); var inheritStderr = !opts.options.stdio; diff --git a/lib/dgram.js b/lib/dgram.js index 355e7d2fbe..fcf9f00a10 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -193,7 +193,7 @@ function bufferSize(self, size, buffer) { return ret; } -Socket.prototype.bind = function(port_, address_ /*, callback*/) { +Socket.prototype.bind = function(port_, address_ /* , callback */) { let port = port_; this._healthCheck(); @@ -160,7 +160,7 @@ fs.Stats = Stats; function isFileType(fileType) { // Use stats array directly to avoid creating an fs.Stats instance just for // our internal use. - return (statValues[1/*mode*/] & S_IFMT) === fileType; + return (statValues[1/* mode */] & S_IFMT) === fileType; } // Don't allow mode to accidentally be overwritten. @@ -1442,7 +1442,7 @@ function StatWatcher() { this._handle.onchange = function(newStatus) { if (oldStatus === -1 && newStatus === -1 && - statValues[2/*new nlink*/] === statValues[16/*old nlink*/]) return; + statValues[2/* new nlink */] === statValues[16/* old nlink */]) return; oldStatus = newStatus; self.emit('change', statsFromValues(), statsFromPrevValues()); diff --git a/lib/fs/promises.js b/lib/fs/promises.js index 8587321464..b4ee81c1a7 100644 --- a/lib/fs/promises.js +++ b/lib/fs/promises.js @@ -133,8 +133,8 @@ async function readFileHandle(filehandle, options) { const statFields = await binding.fstat(filehandle.fd, kUsePromises); let size; - if ((statFields[1/*mode*/] & S_IFMT) === S_IFREG) { - size = statFields[8/*size*/]; + if ((statFields[1/* mode */] & S_IFMT) === S_IFREG) { + size = statFields[8/* size */]; } else { size = 0; } diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 6fb14c6d10..652378ad57 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -702,7 +702,7 @@ Module._extensions['.json'] = function(module, filename) { }; -//Native extension for .node +// Native extension for .node Module._extensions['.node'] = function(module, filename) { return process.dlopen(module, path.toNamespacedPath(filename)); }; diff --git a/lib/internal/url.js b/lib/internal/url.js index 239a17e483..1513b14e82 100644 --- a/lib/internal/url.js +++ b/lib/internal/url.js @@ -712,7 +712,7 @@ function parseParams(qs) { const code = qs.charCodeAt(i); // Try matching key/value pair separator - if (code === 38/*&*/) { + if (code === 38/* & */) { if (pairStart === i) { // We saw an empty substring between pair separators lastPos = pairStart = i + 1; @@ -738,7 +738,7 @@ function parseParams(qs) { } // Try matching key/value separator (e.g. '=') if we haven't already - if (!seenSep && code === 61/*=*/) { + if (!seenSep && code === 61/* = */) { // Key/value separator match! if (lastPos < i) buf += qs.slice(lastPos, i); @@ -755,7 +755,7 @@ function parseParams(qs) { } // Handle + and percent decoding. - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) buf += qs.slice(lastPos, i); buf += ' '; @@ -763,7 +763,7 @@ function parseParams(qs) { } else if (!encoded) { // Try to match an (valid) encoded byte (once) to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; } else if (encodeCheck > 0) { // eslint-disable-next-line no-extra-boolean-cast @@ -799,7 +799,9 @@ function parseParams(qs) { // Adapted from querystring's implementation. // Ref: https://url.spec.whatwg.org/#concept-urlencoded-byte-serializer const noEscape = [ -//0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F +/* + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F +*/ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x00 - 0x0F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x10 - 0x1F 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, // 0x20 - 0x2F diff --git a/lib/querystring.js b/lib/querystring.js index 3bedd493f4..ba676d8c6d 100644 --- a/lib/querystring.js +++ b/lib/querystring.js @@ -76,12 +76,12 @@ function unescapeBuffer(s, decodeSpaces) { var hasHex = false; while (index < s.length) { currentChar = s.charCodeAt(index); - if (currentChar === 43 /*'+'*/ && decodeSpaces) { + if (currentChar === 43 /* '+' */ && decodeSpaces) { out[outIndex++] = 32; // ' ' index++; continue; } - if (currentChar === 37 /*'%'*/ && index < maxLength) { + if (currentChar === 37 /* '%' */ && index < maxLength) { currentChar = s.charCodeAt(++index); hexHigh = unhexTable[currentChar]; if (!(hexHigh >= 0)) { @@ -365,7 +365,7 @@ function parse(qs, sep, eq, options) { if (!keyEncoded) { // Try to match an (valid) encoded byte once to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; continue; } else if (encodeCheck > 0) { @@ -380,7 +380,7 @@ function parse(qs, sep, eq, options) { } } } - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) key += qs.slice(lastPos, i); key += plusChar; @@ -388,7 +388,7 @@ function parse(qs, sep, eq, options) { continue; } } - if (code === 43/*+*/) { + if (code === 43/* + */) { if (lastPos < i) value += qs.slice(lastPos, i); value += plusChar; @@ -396,7 +396,7 @@ function parse(qs, sep, eq, options) { } else if (!valEncoded) { // Try to match an (valid) encoded byte (once) to minimize unnecessary // calls to string decoding functions - if (code === 37/*%*/) { + if (code === 37/* % */) { encodeCheck = 1; } else if (encodeCheck > 0) { // eslint-disable-next-line no-extra-boolean-cast diff --git a/lib/url.js b/lib/url.js index 78c0ea3d17..ac9879a650 100644 --- a/lib/url.js +++ b/lib/url.js @@ -482,19 +482,19 @@ function validateHostname(self, rest, hostname) { // Escaped characters. Use empty strings to fill up unused entries. // Using Array is faster than Object/Map const escapedCodes = [ - /*0 - 9*/ '', '', '', '', '', '', '', '', '', '%09', - /*10 - 19*/ '%0A', '', '', '%0D', '', '', '', '', '', '', - /*20 - 29*/ '', '', '', '', '', '', '', '', '', '', - /*30 - 39*/ '', '', '%20', '', '%22', '', '', '', '', '%27', - /*40 - 49*/ '', '', '', '', '', '', '', '', '', '', - /*50 - 59*/ '', '', '', '', '', '', '', '', '', '', - /*60 - 69*/ '%3C', '', '%3E', '', '', '', '', '', '', '', - /*70 - 79*/ '', '', '', '', '', '', '', '', '', '', - /*80 - 89*/ '', '', '', '', '', '', '', '', '', '', - /*90 - 99*/ '', '', '%5C', '', '%5E', '', '%60', '', '', '', - /*100 - 109*/ '', '', '', '', '', '', '', '', '', '', - /*110 - 119*/ '', '', '', '', '', '', '', '', '', '', - /*120 - 125*/ '', '', '', '%7B', '%7C', '%7D' + /* 0 - 9 */ '', '', '', '', '', '', '', '', '', '%09', + /* 10 - 19 */ '%0A', '', '', '%0D', '', '', '', '', '', '', + /* 20 - 29 */ '', '', '', '', '', '', '', '', '', '', + /* 30 - 39 */ '', '', '%20', '', '%22', '', '', '', '', '%27', + /* 40 - 49 */ '', '', '', '', '', '', '', '', '', '', + /* 50 - 59 */ '', '', '', '', '', '', '', '', '', '', + /* 60 - 69 */ '%3C', '', '%3E', '', '', '', '', '', '', '', + /* 70 - 79 */ '', '', '', '', '', '', '', '', '', '', + /* 80 - 89 */ '', '', '', '', '', '', '', '', '', '', + /* 90 - 99 */ '', '', '%5C', '', '%5E', '', '%60', '', '', '', + /* 100 - 109 */ '', '', '', '', '', '', '', '', '', '', + /* 110 - 119 */ '', '', '', '', '', '', '', '', '', '', + /* 120 - 125 */ '', '', '', '%7B', '%7C', '%7D' ]; // Automatically escape all delimiters and unwise characters from RFC 2396. @@ -592,7 +592,7 @@ Url.prototype.format = function format() { var search = this.search || (query && ('?' + query)) || ''; - if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/*:*/) + if (protocol && protocol.charCodeAt(protocol.length - 1) !== 58/* : */) protocol += ':'; var newPathname = ''; @@ -628,10 +628,10 @@ Url.prototype.format = function format() { pathname = '/' + pathname; host = '//' + host; } else if (protocol.length >= 4 && - protocol.charCodeAt(0) === 102/*f*/ && - protocol.charCodeAt(1) === 105/*i*/ && - protocol.charCodeAt(2) === 108/*l*/ && - protocol.charCodeAt(3) === 101/*e*/) { + protocol.charCodeAt(0) === 102/* f */ && + protocol.charCodeAt(1) === 105/* i */ && + protocol.charCodeAt(2) === 108/* l */ && + protocol.charCodeAt(3) === 101/* e */) { host = '//'; } } @@ -693,7 +693,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result[rkey] = relative[rkey]; } - //urlParse appends trailing / to urls like http://www.example.com + // urlParse appends trailing / to urls like http://www.example.com if (slashedProtocol[result.protocol] && result.hostname && !result.pathname) { result.path = result.pathname = '/'; @@ -819,9 +819,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { // Put this after the other two cases because it simplifies the booleans if (noLeadingSlashes) { result.hostname = result.host = srcPath.shift(); - //occasionally the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + // Occasionally the auth can get stuck only in host. + // This especially happens in cases like + // url.resolveObject('mailto:local1@domain1', 'local2@domain2') const authInHost = result.host && result.host.indexOf('@') > 0 && result.host.split('@'); if (authInHost) { @@ -831,7 +831,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { } result.search = relative.search; result.query = relative.query; - //to support http.request + // To support http.request if (result.pathname !== null || result.search !== null) { result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); @@ -844,7 +844,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { // no path at all. easy. // we've already handled the other stuff above. result.pathname = null; - //to support http.request + // To support http.request if (result.search) { result.path = '/' + result.search; } else { @@ -901,9 +901,9 @@ Url.prototype.resolveObject = function resolveObject(relative) { if (noLeadingSlashes) { result.hostname = result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : ''; - //occasionally the auth can get stuck only in host - //this especially happens in cases like - //url.resolveObject('mailto:local1@domain1', 'local2@domain2') + // Occasionally the auth can get stuck only in host. + // This especially happens in cases like + // url.resolveObject('mailto:local1@domain1', 'local2@domain2') const authInHost = result.host && result.host.indexOf('@') > 0 ? result.host.split('@') : false; if (authInHost) { @@ -925,7 +925,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { result.pathname = srcPath.join('/'); } - //to support request.http + // To support request.http if (result.pathname !== null || result.search !== null) { result.path = (result.pathname ? result.pathname : '') + (result.search ? result.search : ''); diff --git a/lib/util.js b/lib/util.js index a9be7cbda4..003d2dfa68 100644 --- a/lib/util.js +++ b/lib/util.js @@ -284,7 +284,7 @@ function debuglog(set) { * @param {any} value The value to print out. * @param {Object} opts Optional options object that alters the output. */ -/* Legacy: value, showHidden, depth, colors*/ +/* Legacy: value, showHidden, depth, colors */ function inspect(value, opts) { // Default options const ctx = { |