Skip to content

Commit 85dacd6

Browse files
committedJul 7, 2017
lib: use consistent indentation for ternaries
In anticipation of stricter linting for indentation issues, modify ternary operators in lib that do not conform with the expected ESLint settings. PR-URL: #14078 Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 8f3dab4 commit 85dacd6

File tree

6 files changed

+17
-20
lines changed

6 files changed

+17
-20
lines changed
 

‎lib/_stream_readable.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -949,9 +949,7 @@ function fromListPartial(n, list, hasStrings) {
949949
ret = list.shift();
950950
} else {
951951
// result spans more than one buffer
952-
ret = (hasStrings ?
953-
copyFromBufferString(n, list) :
954-
copyFromBuffer(n, list));
952+
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
955953
}
956954
return ret;
957955
}

‎lib/cluster.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,5 @@
2121

2222
'use strict';
2323

24-
module.exports = ('NODE_UNIQUE_ID' in process.env) ?
25-
require('internal/cluster/child') :
26-
require('internal/cluster/master');
24+
const childOrMaster = 'NODE_UNIQUE_ID' in process.env ? 'child' : 'master';
25+
module.exports = require(`internal/cluster/${childOrMaster}`);

‎lib/fs.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1357,9 +1357,8 @@ function FSWatcher() {
13571357
if (status < 0) {
13581358
self._handle.close();
13591359
const error = !filename ?
1360-
errnoException(status, 'Error watching file for changes:') :
1361-
errnoException(status,
1362-
`Error watching file ${filename} for changes:`);
1360+
errnoException(status, 'Error watching file for changes:') :
1361+
errnoException(status, `Error watching file ${filename} for changes:`);
13631362
error.filename = filename;
13641363
self.emit('error', error);
13651364
} else {

‎lib/internal/bootstrap_node.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -275,9 +275,9 @@
275275
enumerable: true,
276276
get: function() {
277277
if (!console) {
278-
console = originalConsole === undefined ?
279-
NativeModule.require('console') :
280-
installInspectorConsole(originalConsole);
278+
console = (originalConsole === undefined) ?
279+
NativeModule.require('console') :
280+
installInspectorConsole(originalConsole);
281281
}
282282
return console;
283283
}

‎lib/internal/child_process.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -883,8 +883,8 @@ function _validateStdio(stdio, sync) {
883883
} else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) ||
884884
getHandleWrapType(stdio._handle)) {
885885
var handle = getHandleWrapType(stdio) ?
886-
stdio :
887-
getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;
886+
stdio :
887+
getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;
888888

889889
acc.push({
890890
type: 'wrap',

‎lib/url.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -395,10 +395,9 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
395395
this.query = Object.create(null);
396396
}
397397

398-
var firstIdx = (questionIdx !== -1 &&
399-
(hashIdx === -1 || questionIdx < hashIdx) ?
400-
questionIdx :
401-
hashIdx);
398+
const useQuestionIdx =
399+
questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx);
400+
const firstIdx = useQuestionIdx ? questionIdx : hashIdx;
402401
if (firstIdx === -1) {
403402
if (rest.length > 0)
404403
this.pathname = rest;
@@ -585,9 +584,11 @@ Url.prototype.format = function format() {
585584
if (this.host) {
586585
host = auth + this.host;
587586
} else if (this.hostname) {
588-
host = auth + (this.hostname.indexOf(':') === -1 ?
587+
host = auth + (
588+
this.hostname.indexOf(':') === -1 ?
589589
this.hostname :
590-
'[' + this.hostname + ']');
590+
'[' + this.hostname + ']'
591+
);
591592
if (this.port) {
592593
host += ':' + this.port;
593594
}

0 commit comments

Comments
 (0)
Please sign in to comment.