Browse Source

lib: fix style issues after eslint update

With an indentation style of two spaces, it is not possible to indent
multiline variable declarations by four spaces. Instead, the var keyword
is used on every new line.
Use const instead of var where applicable for changed lines.

PR-URL: https://github.com/nodejs/io.js/pull/2286
Reviewed-By: Roman Reiss <me@silverwind.io>
v4.x
Michaël Zasso 9 years ago
committed by Myles Borins
parent
commit
15ed64e34c
  1. 112
      lib/_debugger.js
  2. 2
      lib/_http_server.js
  3. 16
      lib/_tls_legacy.js
  4. 14
      lib/_tls_wrap.js
  5. 10
      lib/assert.js
  6. 22
      lib/fs.js
  7. 14
      lib/internal/child_process.js
  8. 20
      lib/net.js
  9. 68
      lib/path.js
  10. 6
      lib/querystring.js
  11. 4
      lib/readline.js
  12. 12
      lib/tls.js
  13. 42
      lib/url.js

112
lib/_debugger.js

@ -25,8 +25,8 @@ exports.start = function(argv, stdin, stdout) {
stdin = stdin || process.stdin; stdin = stdin || process.stdin;
stdout = stdout || process.stdout; stdout = stdout || process.stdout;
var args = ['--debug-brk'].concat(argv), const args = ['--debug-brk'].concat(argv);
interface_ = new Interface(stdin, stdout, args); const interface_ = new Interface(stdin, stdout, args);
stdin.resume(); stdin.resume();
@ -197,8 +197,8 @@ Client.prototype._removeScript = function(desc) {
Client.prototype._onResponse = function(res) { Client.prototype._onResponse = function(res) {
var cb, var cb;
index = -1; var index = -1;
this._reqCallbacks.some(function(fn, i) { this._reqCallbacks.some(function(fn, i) {
if (fn.request_seq == res.body.request_seq) { if (fn.request_seq == res.body.request_seq) {
@ -295,11 +295,11 @@ Client.prototype.reqLookup = function(refs, cb) {
}; };
Client.prototype.reqScopes = function(cb) { Client.prototype.reqScopes = function(cb) {
var self = this, const self = this;
req = { const req = {
command: 'scopes', command: 'scopes',
arguments: {} arguments: {}
}; };
cb = cb || function() {}; cb = cb || function() {};
this.req(req, function(err, res) { this.req(req, function(err, res) {
@ -525,8 +525,8 @@ Client.prototype.mirrorObject = function(handle, depth, cb) {
return; return;
} }
var mirror, var mirror;
waiting = 1; var waiting = 1;
if (handle.className == 'Array') { if (handle.className == 'Array') {
mirror = []; mirror = [];
@ -676,8 +676,8 @@ var helpMessage = 'Commands: ' + commands.map(function(group) {
function SourceUnderline(sourceText, position, repl) { function SourceUnderline(sourceText, position, repl) {
if (!sourceText) return ''; if (!sourceText) return '';
var head = sourceText.slice(0, position), const head = sourceText.slice(0, position);
tail = sourceText.slice(position); var tail = sourceText.slice(position);
// Colourize char if stdout supports colours // Colourize char if stdout supports colours
if (repl.useColors) { if (repl.useColors) {
@ -697,8 +697,8 @@ function SourceInfo(body) {
if (body.script) { if (body.script) {
if (body.script.name) { if (body.script.name) {
var name = body.script.name, var name = body.script.name;
dir = path.resolve() + '/'; const dir = path.resolve() + '/';
// Change path to relative, if possible // Change path to relative, if possible
if (name.indexOf(dir) === 0) { if (name.indexOf(dir) === 0) {
@ -969,8 +969,8 @@ Interface.prototype.controlEval = function(code, context, filename, callback) {
Interface.prototype.debugEval = function(code, context, filename, callback) { Interface.prototype.debugEval = function(code, context, filename, callback) {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var self = this, const self = this;
client = this.client; const client = this.client;
// Repl asked for scope variables // Repl asked for scope variables
if (code === '.scope') { if (code === '.scope') {
@ -1004,9 +1004,9 @@ Interface.prototype.debugEval = function(code, context, filename, callback) {
// Adds spaces and prefix to number // Adds spaces and prefix to number
// maxN is a maximum number we should have space for // maxN is a maximum number we should have space for
function leftPad(n, prefix, maxN) { function leftPad(n, prefix, maxN) {
var s = n.toString(), const s = n.toString();
nchars = Math.max(2, String(maxN).length) + 1, const nchars = Math.max(2, String(maxN).length) + 1;
nspaces = nchars - s.length - 1; const nspaces = nchars - s.length - 1;
for (var i = 0; i < nspaces; i++) { for (var i = 0; i < nspaces; i++) {
prefix += ' '; prefix += ' ';
@ -1078,10 +1078,10 @@ Interface.prototype.list = function(delta) {
delta || (delta = 5); delta || (delta = 5);
var self = this, const self = this;
client = this.client, const client = this.client;
from = client.currentSourceLine - delta + 1, const from = client.currentSourceLine - delta + 1;
to = client.currentSourceLine + delta + 1; const to = client.currentSourceLine + delta + 1;
self.pause(); self.pause();
client.reqSource(from, to, function(err, res) { client.reqSource(from, to, function(err, res) {
@ -1096,12 +1096,12 @@ Interface.prototype.list = function(delta) {
var lineno = res.fromLine + i + 1; var lineno = res.fromLine + i + 1;
if (lineno < from || lineno > to) continue; if (lineno < from || lineno > to) continue;
var current = lineno == 1 + client.currentSourceLine, const current = lineno == 1 + client.currentSourceLine;
breakpoint = client.breakpoints.some(function(bp) { const breakpoint = client.breakpoints.some(function(bp) {
return (bp.scriptReq === client.currentScript || return (bp.scriptReq === client.currentScript ||
bp.script === client.currentScript) && bp.script === client.currentScript) &&
bp.line == lineno; bp.line == lineno;
}); });
if (lineno == 1) { if (lineno == 1) {
// The first line needs to have the module wrapper filtered out of // The first line needs to have the module wrapper filtered out of
@ -1139,8 +1139,8 @@ Interface.prototype.list = function(delta) {
Interface.prototype.backtrace = function() { Interface.prototype.backtrace = function() {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var self = this, const self = this;
client = this.client; const client = this.client;
self.pause(); self.pause();
client.fullTrace(function(err, bt) { client.fullTrace(function(err, bt) {
@ -1153,8 +1153,8 @@ Interface.prototype.backtrace = function() {
if (bt.totalFrames == 0) { if (bt.totalFrames == 0) {
self.print('(empty stack)'); self.print('(empty stack)');
} else { } else {
var trace = [], const trace = [];
firstFrameNative = bt.frames[0].script.isNative; const firstFrameNative = bt.frames[0].script.isNative;
for (var i = 0; i < bt.frames.length; i++) { for (var i = 0; i < bt.frames.length; i++) {
var frame = bt.frames[i]; var frame = bt.frames[i];
@ -1183,9 +1183,9 @@ Interface.prototype.backtrace = function() {
Interface.prototype.scripts = function() { Interface.prototype.scripts = function() {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var client = this.client, const client = this.client;
displayNatives = arguments[0] || false, const displayNatives = arguments[0] || false;
scripts = []; const scripts = [];
this.pause(); this.pause();
for (var id in client.scripts) { for (var id in client.scripts) {
@ -1323,9 +1323,9 @@ Interface.prototype.setBreakpoint = function(script, line,
condition, silent) { condition, silent) {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var self = this, const self = this;
scriptId, var scriptId;
ambiguous; var ambiguous;
// setBreakpoint() should insert breakpoint on current line // setBreakpoint() should insert breakpoint on current line
if (script === undefined) { if (script === undefined) {
@ -1429,10 +1429,10 @@ Interface.prototype.setBreakpoint = function(script, line,
Interface.prototype.clearBreakpoint = function(script, line) { Interface.prototype.clearBreakpoint = function(script, line) {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var ambiguous, var ambiguous;
breakpoint, var breakpoint;
scriptId, var scriptId;
index; var index;
this.client.breakpoints.some(function(bp, i) { this.client.breakpoints.some(function(bp, i) {
if (bp.scriptId === script || if (bp.scriptId === script ||
@ -1474,10 +1474,8 @@ Interface.prototype.clearBreakpoint = function(script, line) {
return this.error('Breakpoint not found on line ' + line); return this.error('Breakpoint not found on line ' + line);
} }
var self = this, var self = this;
req = { const req = {breakpoint};
breakpoint: breakpoint
};
self.pause(); self.pause();
self.client.clearBreakpoint(req, function(err, res) { self.client.clearBreakpoint(req, function(err, res) {
@ -1513,8 +1511,8 @@ Interface.prototype.breakpoints = function() {
Interface.prototype.pause_ = function() { Interface.prototype.pause_ = function() {
if (!this.requireConnection()) return; if (!this.requireConnection()) return;
var self = this, const self = this;
cmd = 'process._debugPause();'; const cmd = 'process._debugPause();';
this.pause(); this.pause();
this.client.reqFrameEval(cmd, NO_FRAME, function(err, res) { this.client.reqFrameEval(cmd, NO_FRAME, function(err, res) {
@ -1621,11 +1619,11 @@ Interface.prototype.killChild = function() {
// Spawns child process (and restores breakpoints) // Spawns child process (and restores breakpoints)
Interface.prototype.trySpawn = function(cb) { Interface.prototype.trySpawn = function(cb) {
var self = this, const self = this;
breakpoints = this.breakpoints || [], const breakpoints = this.breakpoints || [];
port = exports.port, var port = exports.port;
host = '127.0.0.1', var host = '127.0.0.1';
childArgs = this.args; var childArgs = this.args;
this.killChild(); this.killChild();
assert(!this.child); assert(!this.child);
@ -1676,8 +1674,8 @@ Interface.prototype.trySpawn = function(cb) {
this.pause(); this.pause();
var client = self.client = new Client(), const client = self.client = new Client();
connectionAttempts = 0; var connectionAttempts = 0;
client.once('ready', function() { client.once('ready', function() {
self.stdout.write(' ok\n'); self.stdout.write(' ok\n');

2
lib/_http_server.js

@ -64,7 +64,7 @@ const STATUS_CODES = exports.STATUS_CODES = {
426 : 'Upgrade Required', // RFC 2817 426 : 'Upgrade Required', // RFC 2817
428 : 'Precondition Required', // RFC 6585 428 : 'Precondition Required', // RFC 6585
429 : 'Too Many Requests', // RFC 6585 429 : 'Too Many Requests', // RFC 6585
431 : 'Request Header Fields Too Large',// RFC 6585 431 : 'Request Header Fields Too Large', // RFC 6585
500 : 'Internal Server Error', 500 : 'Internal Server Error',
501 : 'Not Implemented', 501 : 'Not Implemented',
502 : 'Bad Gateway', 502 : 'Bad Gateway',

16
lib/_tls_legacy.js

@ -224,9 +224,9 @@ CryptoStream.prototype._write = function write(data, encoding, cb) {
CryptoStream.prototype._writePending = function writePending() { CryptoStream.prototype._writePending = function writePending() {
var data = this._pending, const data = this._pending;
encoding = this._pendingEncoding, const encoding = this._pendingEncoding;
cb = this._pendingCallback; const cb = this._pendingCallback;
this._pending = null; this._pending = null;
this._pendingEncoding = ''; this._pendingEncoding = '';
@ -252,9 +252,9 @@ CryptoStream.prototype._read = function read(size) {
out = this.pair.ssl.encOut; out = this.pair.ssl.encOut;
} }
var bytesRead = 0, var bytesRead = 0;
start = this._buffer.offset, const start = this._buffer.offset;
last = start; var last = start;
do { do {
assert(last === this._buffer.offset); assert(last === this._buffer.offset);
var read = this._buffer.use(this.pair.ssl, out, size - bytesRead); var read = this._buffer.use(this.pair.ssl, out, size - bytesRead);
@ -604,8 +604,8 @@ function onhandshakedone() {
function onclienthello(hello) { function onclienthello(hello) {
var self = this, const self = this;
once = false; var once = false;
this._resumingSession = true; this._resumingSession = true;
function callback(err, session) { function callback(err, session) {

14
lib/_tls_wrap.js

@ -397,8 +397,8 @@ TLSSocket.prototype._init = function(socket, wrap) {
// For clients, we will always have either a given ca list or be using // For clients, we will always have either a given ca list or be using
// default one // default one
var requestCert = !!options.requestCert || !options.isServer, const requestCert = !!options.requestCert || !options.isServer;
rejectUnauthorized = !!options.rejectUnauthorized; const rejectUnauthorized = !!options.rejectUnauthorized;
this._requestCert = requestCert; this._requestCert = requestCert;
this._rejectUnauthorized = rejectUnauthorized; this._rejectUnauthorized = rejectUnauthorized;
@ -494,8 +494,8 @@ TLSSocket.prototype._init = function(socket, wrap) {
}; };
TLSSocket.prototype.renegotiate = function(options, callback) { TLSSocket.prototype.renegotiate = function(options, callback) {
var requestCert = this._requestCert, var requestCert = this._requestCert;
rejectUnauthorized = this._rejectUnauthorized; var rejectUnauthorized = this._rejectUnauthorized;
if (this.destroyed) if (this.destroyed)
return; return;
@ -966,9 +966,9 @@ exports.connect = function(/* [port, host], options, cb */) {
var hostname = options.servername || var hostname = options.servername ||
options.host || options.host ||
(options.socket && options.socket._host) || (options.socket && options.socket._host) ||
'localhost', 'localhost';
NPN = {}, const NPN = {};
context = tls.createSecureContext(options); const context = tls.createSecureContext(options);
tls.convertNPNProtocols(options.NPNProtocols, NPN); tls.convertNPNProtocols(options.NPNProtocols, NPN);
var socket = new TLSSocket(options.socket, { var socket = new TLSSocket(options.socket, {

10
lib/assert.js

@ -198,8 +198,8 @@ function objEquiv(a, b, strict) {
return a === b; return a === b;
if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b)) if (strict && Object.getPrototypeOf(a) !== Object.getPrototypeOf(b))
return false; return false;
var aIsArgs = isArguments(a), const aIsArgs = isArguments(a);
bIsArgs = isArguments(b); const bIsArgs = isArguments(b);
if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs)) if ((aIsArgs && !bIsArgs) || (!aIsArgs && bIsArgs))
return false; return false;
if (aIsArgs) { if (aIsArgs) {
@ -207,9 +207,9 @@ function objEquiv(a, b, strict) {
b = pSlice.call(b); b = pSlice.call(b);
return _deepEqual(a, b, strict); return _deepEqual(a, b, strict);
} }
var ka = Object.keys(a), const ka = Object.keys(a);
kb = Object.keys(b), const kb = Object.keys(b);
key, i; var key, i;
// having the same number of owned properties (keys incorporates // having the same number of owned properties (keys incorporates
// hasOwnProperty) // hasOwnProperty)
if (ka.length !== kb.length) if (ka.length !== kb.length)

22
lib/fs.js

@ -552,8 +552,8 @@ fs.openSync = function(path, flags, mode) {
fs.read = function(fd, buffer, offset, length, position, callback) { fs.read = function(fd, buffer, offset, length, position, callback) {
if (!(buffer instanceof Buffer)) { if (!(buffer instanceof Buffer)) {
// legacy string interface (fd, length, position, encoding, callback) // legacy string interface (fd, length, position, encoding, callback)
var cb = arguments[4], const cb = arguments[4];
encoding = arguments[3]; const encoding = arguments[3];
assertEncoding(encoding); assertEncoding(encoding);
@ -1388,9 +1388,9 @@ fs.realpathSync = function realpathSync(p, cache) {
return cache[p]; return cache[p];
} }
var original = p, const original = p;
seenLinks = {}, const seenLinks = {};
knownHard = {}; const knownHard = {};
// current character position in p // current character position in p
var pos; var pos;
@ -1490,9 +1490,9 @@ fs.realpath = function realpath(p, cache, cb) {
return process.nextTick(cb.bind(null, null, cache[p])); return process.nextTick(cb.bind(null, null, cache[p]));
} }
var original = p, const original = p;
seenLinks = {}, const seenLinks = {};
knownHard = {}; const knownHard = {};
// current character position in p // current character position in p
var pos; var pos;
@ -1941,9 +1941,9 @@ util.inherits(SyncWriteStream, Stream);
// Export // Export
Object.defineProperty(fs, 'SyncWriteStream', { Object.defineProperty(fs, 'SyncWriteStream', {
configurable: true, configurable: true,
writable: true, writable: true,
value: SyncWriteStream value: SyncWriteStream
}); });
SyncWriteStream.prototype.write = function(data, arg1, arg2) { SyncWriteStream.prototype.write = function(data, arg1, arg2) {

14
lib/internal/child_process.js

@ -250,11 +250,11 @@ function getHandleWrapType(stream) {
ChildProcess.prototype.spawn = function(options) { ChildProcess.prototype.spawn = function(options) {
var self = this, const self = this;
ipc, var ipc;
ipcFd, var ipcFd;
// If no `stdio` option was given - use default // If no `stdio` option was given - use default
stdio = options.stdio || 'pipe'; var stdio = options.stdio || 'pipe';
stdio = _validateStdio(stdio, false); stdio = _validateStdio(stdio, false);
@ -692,8 +692,8 @@ function handleMessage(target, message, handle) {
function nop() { } function nop() { }
function _validateStdio(stdio, sync) { function _validateStdio(stdio, sync) {
var ipc, var ipc;
ipcFd; var ipcFd;
// Replace shortcut with an array // Replace shortcut with an array
if (typeof stdio === 'string') { if (typeof stdio === 'string') {

20
lib/net.js

@ -722,10 +722,10 @@ function createWriteReq(req, handle, data, encoding) {
Socket.prototype.__defineGetter__('bytesWritten', function() { Socket.prototype.__defineGetter__('bytesWritten', function() {
var bytes = this._bytesDispatched, var bytes = this._bytesDispatched;
state = this._writableState, const state = this._writableState;
data = this._pendingData, const data = this._pendingData;
encoding = this._pendingEncoding; const encoding = this._pendingEncoding;
if (!state) if (!state)
return undefined; return undefined;
@ -1132,8 +1132,7 @@ function _listen(handle, backlog) {
return handle.listen(backlog || 511); return handle.listen(backlog || 511);
} }
var createServerHandle = exports._createServerHandle = function createServerHandle(address, port, addressType, fd) {
function(address, port, addressType, fd) {
var err = 0; 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 handle;
@ -1189,6 +1188,7 @@ var createServerHandle = exports._createServerHandle =
return handle; return handle;
}; };
exports._createServerHandle = createServerHandle;
Server.prototype._listen2 = function(address, port, addressType, backlog, fd) { Server.prototype._listen2 = function(address, port, addressType, backlog, fd) {
@ -1444,8 +1444,8 @@ Server.prototype.getConnections = function(cb) {
} }
// Poll slaves // Poll slaves
var left = this._slaves.length, var left = this._slaves.length;
total = this._connections; var total = this._connections;
function oncount(err, count) { function oncount(err, count) {
if (err) { if (err) {
@ -1487,8 +1487,8 @@ Server.prototype.close = function(cb) {
} }
if (this._usingSlaves) { if (this._usingSlaves) {
var self = this, var self = this;
left = this._slaves.length; var left = this._slaves.length;
// Increment connections to be sure that, even if all sockets will be closed // Increment connections to be sure that, even if all sockets will be closed
// during polling of slaves, `close` event will be emitted only once. // during polling of slaves, `close` event will be emitted only once.

68
lib/path.js

@ -74,21 +74,21 @@ var win32 = {};
// Function to split a filename into [root, dir, basename, ext] // Function to split a filename into [root, dir, basename, ext]
function win32SplitPath(filename) { function win32SplitPath(filename) {
// Separate device+slash from tail // Separate device+slash from tail
var result = splitDeviceRe.exec(filename), const result = splitDeviceRe.exec(filename);
device = (result[1] || '') + (result[2] || ''), const device = (result[1] || '') + (result[2] || '');
tail = result[3]; const tail = result[3];
// Split the tail into dir, basename and extension // Split the tail into dir, basename and extension
var result2 = splitTailRe.exec(tail), const result2 = splitTailRe.exec(tail);
dir = result2[1], const dir = result2[1];
basename = result2[2], const basename = result2[2];
ext = result2[3]; const ext = result2[3];
return [device, dir, basename, ext]; return [device, dir, basename, ext];
} }
function win32StatPath(path) { function win32StatPath(path) {
var result = splitDeviceRe.exec(path), const result = splitDeviceRe.exec(path);
device = result[1] || '', const device = result[1] || '';
isUnc = !!device && device[1] !== ':'; const isUnc = !!device && device[1] !== ':';
return { return {
device, device,
isUnc, isUnc,
@ -103,9 +103,9 @@ function normalizeUNCRoot(device) {
// path.resolve([from ...], to) // path.resolve([from ...], to)
win32.resolve = function() { win32.resolve = function() {
var resolvedDevice = '', var resolvedDevice = '';
resolvedTail = '', var resolvedTail = '';
resolvedAbsolute = false; var resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1; i--) { for (var i = arguments.length - 1; i >= -1; i--) {
var path; var path;
@ -134,11 +134,11 @@ win32.resolve = function() {
continue; continue;
} }
var result = win32StatPath(path), const result = win32StatPath(path);
device = result.device, const device = result.device;
isUnc = result.isUnc, var isUnc = result.isUnc;
isAbsolute = result.isAbsolute, const isAbsolute = result.isAbsolute;
tail = result.tail; const tail = result.tail;
if (device && if (device &&
resolvedDevice && resolvedDevice &&
@ -182,12 +182,12 @@ win32.resolve = function() {
win32.normalize = function(path) { win32.normalize = function(path) {
assertPath(path); assertPath(path);
var result = win32StatPath(path), const result = win32StatPath(path);
device = result.device, var device = result.device;
isUnc = result.isUnc, const isUnc = result.isUnc;
isAbsolute = result.isAbsolute, const isAbsolute = result.isAbsolute;
tail = result.tail, var tail = result.tail;
trailingSlash = /[\\\/]$/.test(tail); const trailingSlash = /[\\\/]$/.test(tail);
// Normalize the tail path // Normalize the tail path
tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\'); tail = normalizeArray(tail.split(/[\\\/]+/), !isAbsolute).join('\\');
@ -318,9 +318,9 @@ win32._makeLong = function(path) {
win32.dirname = function(path) { win32.dirname = function(path) {
var result = win32SplitPath(path), const result = win32SplitPath(path);
root = result[0], const root = result[0];
dir = result[1]; var dir = result[1];
if (!root && !dir) { if (!root && !dir) {
// No dirname whatsoever // No dirname whatsoever
@ -417,8 +417,8 @@ function posixSplitPath(filename) {
// path.resolve([from ...], to) // path.resolve([from ...], to)
// posix version // posix version
posix.resolve = function() { posix.resolve = function() {
var resolvedPath = '', var resolvedPath = '';
resolvedAbsolute = false; var resolvedAbsolute = false;
for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) { for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
var path = (i >= 0) ? arguments[i] : process.cwd(); var path = (i >= 0) ? arguments[i] : process.cwd();
@ -449,8 +449,8 @@ posix.resolve = function() {
posix.normalize = function(path) { posix.normalize = function(path) {
assertPath(path); assertPath(path);
var isAbsolute = posix.isAbsolute(path), const isAbsolute = posix.isAbsolute(path);
trailingSlash = path && path[path.length - 1] === '/'; const trailingSlash = path && path[path.length - 1] === '/';
// Normalize the path // Normalize the path
path = normalizeArray(path.split('/'), !isAbsolute).join('/'); path = normalizeArray(path.split('/'), !isAbsolute).join('/');
@ -527,9 +527,9 @@ posix._makeLong = function(path) {
posix.dirname = function(path) { posix.dirname = function(path) {
var result = posixSplitPath(path), const result = posixSplitPath(path);
root = result[0], const root = result[0];
dir = result[1]; var dir = result[1];
if (!root && !dir) { if (!root && !dir) {
// No dirname whatsoever // No dirname whatsoever

6
lib/querystring.js

@ -230,9 +230,9 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq, options) {
var keys = []; var keys = [];
for (var i = 0; i < len; ++i) { for (var i = 0; i < len; ++i) {
var x = qs[i].replace(regexp, '%20'), const x = qs[i].replace(regexp, '%20');
idx = x.indexOf(eq), const idx = x.indexOf(eq);
k, v; var k, v;
if (idx >= 0) { if (idx >= 0) {
k = decodeStr(x.substring(0, idx), decode); k = decodeStr(x.substring(0, idx), decode);

4
lib/readline.js

@ -379,8 +379,8 @@ Interface.prototype._tabComplete = function() {
return; return;
} }
var completions = rv[0], const completions = rv[0];
completeOn = rv[1]; // the text that was completed const completeOn = rv[1]; // the text that was completed
if (completions && completions.length) { if (completions && completions.length) {
// Apply/show completions. // Apply/show completions.
if (completions.length === 1) { if (completions.length === 1) {

12
lib/tls.js

@ -90,12 +90,12 @@ exports.checkServerIdentity = function checkServerIdentity(host, cert) {
return new RegExp('^' + re + '$', 'i'); return new RegExp('^' + re + '$', 'i');
} }
var dnsNames = [], var dnsNames = [];
uriNames = [], var uriNames = [];
ips = [], const ips = [];
matchCN = true, var matchCN = true;
valid = false, var valid = false;
reason = 'Unknown reason'; var reason = 'Unknown reason';
// There're several names to perform check against: // There're several names to perform check against:
// CN and altnames in certificate extension // CN and altnames in certificate extension

42
lib/url.js

@ -93,11 +93,11 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
// Copy chrome, IE, opera backslash-handling behavior. // Copy chrome, IE, opera backslash-handling behavior.
// Back slashes before the query string get converted to forward slashes // Back slashes before the query string get converted to forward slashes
// See: https://code.google.com/p/chromium/issues/detail?id=25916 // See: https://code.google.com/p/chromium/issues/detail?id=25916
var queryIndex = url.indexOf('?'), const queryIndex = url.indexOf('?');
splitter = const splitter =
(queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#', (queryIndex !== -1 && queryIndex < url.indexOf('#')) ? '?' : '#';
uSplit = url.split(splitter), const uSplit = url.split(splitter);
slashRegex = /\\/g; const slashRegex = /\\/g;
uSplit[0] = uSplit[0].replace(slashRegex, '/'); uSplit[0] = uSplit[0].replace(slashRegex, '/');
url = uSplit.join(splitter); url = uSplit.join(splitter);
@ -370,11 +370,11 @@ Url.prototype.format = function() {
auth += '@'; auth += '@';
} }
var protocol = this.protocol || '', var protocol = this.protocol || '';
pathname = this.pathname || '', var pathname = this.pathname || '';
hash = this.hash || '', var hash = this.hash || '';
host = false, var host = false;
query = ''; var query = '';
if (this.host) { if (this.host) {
host = auth + this.host; host = auth + this.host;
@ -525,17 +525,17 @@ Url.prototype.resolveObject = function(relative) {
return result; return result;
} }
var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'), const isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/');
isRelAbs = ( const isRelAbs = (
relative.host || relative.host ||
relative.pathname && relative.pathname.charAt(0) === '/' relative.pathname && relative.pathname.charAt(0) === '/'
), );
mustEndAbs = (isRelAbs || isSourceAbs || var mustEndAbs = (isRelAbs || isSourceAbs ||
(result.host && relative.pathname)), (result.host && relative.pathname));
removeAllDots = mustEndAbs, const removeAllDots = mustEndAbs;
srcPath = result.pathname && result.pathname.split('/') || [], var srcPath = result.pathname && result.pathname.split('/') || [];
relPath = relative.pathname && relative.pathname.split('/') || [], var relPath = relative.pathname && relative.pathname.split('/') || [];
psychotic = result.protocol && !slashedProtocol[result.protocol]; const psychotic = result.protocol && !slashedProtocol[result.protocol];
// if the url is a non-slashed url, then relative // if the url is a non-slashed url, then relative
// links like ../.. should be able // links like ../.. should be able

Loading…
Cancel
Save