Skip to content

Commit de0b8d6

Browse files
rmustaccry
authored andcommitted
jslint cleanup: path.js, readline.js, repl.js, tls.js, tty_win32.js, url.js
1 parent 703a1ff commit de0b8d6

6 files changed

Lines changed: 31 additions & 36 deletions

File tree

lib/path.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ if (isWindows) {
7373
resolvedAbsolute = false;
7474

7575
for (var i = arguments.length; i >= -1; i--) {
76-
var path = (i >= 0)
77-
? arguments[i]
78-
: process.cwd();
76+
var path = (i >= 0) ? arguments[i] : process.cwd();
7977

8078
// Skip empty and invalid entries
8179
if (typeof path !== 'string' || !path) {
@@ -202,12 +200,12 @@ if (isWindows) {
202200

203201
function trim(arr) {
204202
var start = 0;
205-
for(;start < arr.length; start++) {
203+
for (; start < arr.length; start++) {
206204
if (arr[start] !== '') break;
207205
}
208206

209207
var end = arr.length - 1;
210-
for(;end >= 0; end--) {
208+
for (; end >= 0; end--) {
211209
if (arr[end] !== '') break;
212210
}
213211

@@ -223,7 +221,7 @@ if (isWindows) {
223221

224222
var length = Math.min(lowerFromParts.length, lowerToParts.length);
225223
var samePartsLength = length;
226-
for(var i = 0; i < length; i++) {
224+
for (var i = 0; i < length; i++) {
227225
if (lowerFromParts[i] !== lowerToParts[i]) {
228226
samePartsLength = i;
229227
break;
@@ -235,7 +233,7 @@ if (isWindows) {
235233
}
236234

237235
var outputParts = [];
238-
for(var i = samePartsLength; i < lowerFromParts.length; i++) {
236+
for (var i = samePartsLength; i < lowerFromParts.length; i++) {
239237
outputParts.push('..');
240238
}
241239

@@ -258,9 +256,7 @@ if (isWindows) {
258256
resolvedAbsolute = false;
259257

260258
for (var i = arguments.length; i >= -1 && !resolvedAbsolute; i--) {
261-
var path = (i >= 0)
262-
? arguments[i]
263-
: process.cwd();
259+
var path = (i >= 0) ? arguments[i] : process.cwd();
264260

265261
// Skip empty and invalid entries
266262
if (typeof path !== 'string' || !path) {
@@ -321,12 +317,12 @@ if (isWindows) {
321317

322318
function trim(arr) {
323319
var start = 0;
324-
for(;start < arr.length; start++) {
320+
for (; start < arr.length; start++) {
325321
if (arr[start] !== '') break;
326322
}
327323

328324
var end = arr.length - 1;
329-
for(;end >= 0; end--) {
325+
for (; end >= 0; end--) {
330326
if (arr[end] !== '') break;
331327
}
332328

@@ -339,15 +335,15 @@ if (isWindows) {
339335

340336
var length = Math.min(fromParts.length, toParts.length);
341337
var samePartsLength = length;
342-
for(var i = 0; i < length; i++) {
338+
for (var i = 0; i < length; i++) {
343339
if (fromParts[i] !== toParts[i]) {
344340
samePartsLength = i;
345341
break;
346342
}
347343
}
348344

349345
var outputParts = [];
350-
for(var i = samePartsLength; i < fromParts.length; i++) {
346+
for (var i = samePartsLength; i < fromParts.length; i++) {
351347
outputParts.push('..');
352348
}
353349

lib/readline.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ Interface.prototype._wordLeft = function() {
335335
this.cursor -= match[0].length;
336336
this._refreshLine();
337337
}
338-
}
338+
};
339339

340340

341341
Interface.prototype._wordRight = function() {
@@ -345,7 +345,7 @@ Interface.prototype._wordRight = function() {
345345
this.cursor += match[0].length;
346346
this._refreshLine();
347347
}
348-
}
348+
};
349349

350350

351351
Interface.prototype._deleteLeft = function() {
@@ -375,7 +375,7 @@ Interface.prototype._deleteWordLeft = function() {
375375
this.cursor = leading.length;
376376
this._refreshLine();
377377
}
378-
}
378+
};
379379

380380

381381
Interface.prototype._deleteWordRight = function() {
@@ -386,20 +386,20 @@ Interface.prototype._deleteWordRight = function() {
386386
trailing.slice(match[0].length);
387387
this._refreshLine();
388388
}
389-
}
389+
};
390390

391391

392392
Interface.prototype._deleteLineLeft = function() {
393393
this.line = this.line.slice(this.cursor);
394394
this.cursor = 0;
395395
this._refreshLine();
396-
}
396+
};
397397

398398

399399
Interface.prototype._deleteLineRight = function() {
400400
this.line = this.line.slice(0, this.cursor);
401401
this._refreshLine();
402-
}
402+
};
403403

404404

405405
Interface.prototype._line = function() {
@@ -454,11 +454,11 @@ Interface.prototype._ttyWrite = function(s, key) {
454454
if (key.ctrl && key.shift) {
455455
/* Control and shift pressed */
456456
switch (key.name) {
457-
case "backspace":
457+
case 'backspace':
458458
this._deleteLineLeft();
459459
break;
460460

461-
case "delete":
461+
case 'delete':
462462
this._deleteLineRight();
463463
break;
464464
}

lib/repl.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ function REPLServer(prompt, stream) {
104104
var sawSIGINT = false;
105105
rli.on('SIGINT', function() {
106106
if (sawSIGINT) {
107-
rli.close();
108-
process.exit();
107+
rli.close();
108+
process.exit();
109109
}
110110
var bareInt = false;
111111
if (!(self.bufferedCommand && self.bufferedCommand.length > 0) &&
@@ -298,7 +298,7 @@ REPLServer.prototype.complete = function(line) {
298298
var filter = match[1];
299299
var dir, files, f, name, base, ext, abs, subfiles, s;
300300
group = [];
301-
var paths = module.paths.concat(require("module").globalPaths);
301+
var paths = module.paths.concat(require('module').globalPaths);
302302
for (i = 0; i < paths.length; i++) {
303303
dir = path.resolve(paths[i], subdir);
304304
try {

lib/tls.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function convertNPNProtocols(NPNProtocols, out) {
6969
if (Buffer.isBuffer(NPNProtocols)) {
7070
out.NPNProtocols = NPNProtocols;
7171
}
72-
};
72+
}
7373

7474
// Base class of both CleartextStream and EncryptedStream
7575
function CryptoStream(pair) {
@@ -379,7 +379,7 @@ CryptoStream.prototype._pull = function() {
379379
this.pair.encrypted._destroyAfterPush = true;
380380
}
381381
this.pair.cycle();
382-
this._done()
382+
this._done();
383383
return;
384384
}
385385

@@ -514,9 +514,8 @@ function SecurePair(credentials, isServer, requestCert, rejectUnauthorized,
514514
this._requestCert = requestCert ? true : false;
515515

516516
this.ssl = new Connection(this.credentials.context,
517-
this._isServer ? true : false,
518-
this._requestCert,
519-
this._rejectUnauthorized);
517+
this._isServer ? true : false, this._requestCert,
518+
this._rejectUnauthorized);
520519

521520
if (NPN_ENABLED && NPNProtocols) {
522521
this.ssl.setNPNProtocols(NPNProtocols);
@@ -593,28 +592,28 @@ SecurePair.prototype.cycle = function(depth) {
593592

594593
if (!this.cycleEncryptedPullLock) {
595594
this.cycleEncryptedPullLock = true;
596-
debug("encrypted._pull");
595+
debug('encrypted._pull');
597596
this.encrypted._pull();
598597
this.cycleEncryptedPullLock = false;
599598
}
600599

601600
if (!this.cycleCleartextPullLock) {
602601
this.cycleCleartextPullLock = true;
603-
debug("cleartext._pull");
602+
debug('cleartext._pull');
604603
this.cleartext._pull();
605604
this.cycleCleartextPullLock = false;
606605
}
607606

608607
if (!this.cycleCleartextPushLock) {
609608
this.cycleCleartextPushLock = true;
610-
debug("cleartext._push");
609+
debug('cleartext._push');
611610
this.cleartext._push();
612611
this.cycleCleartextPushLock = false;
613612
}
614613

615614
if (!this.cycleEncryptedPushLock) {
616615
this.cycleEncryptedPushLock = true;
617-
debug("encrypted._push");
616+
debug('encrypted._push');
618617
this.encrypted._push();
619618
this.cycleEncryptedPushLock = false;
620619
}

lib/tty_win32.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ WriteStream.prototype.isTTY = true;
120120

121121
WriteStream.prototype.write = function(data, encoding) {
122122
if (!this.writable) {
123-
this.emit("error", new Error('stream not writable'));
123+
this.emit('error', new Error('stream not writable'));
124124
return false;
125125
}
126126

lib/url.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ function urlParse(url, parseQueryString, slashesDenoteHost) {
231231
for (var i = 0; i < domainArray.length; ++i) {
232232
var s = domainArray[i];
233233
newOut.push(s.match(/[^A-Za-z0-9_-]/) ?
234-
'xn--' + punycode.encode(s) : s);
234+
'xn--' + punycode.encode(s) : s);
235235
}
236236
out.hostname = newOut.join('.');
237237

0 commit comments

Comments
 (0)