Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lib: use consistent indentation for ternaries #14078

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/_stream_readable.js
Original file line number Diff line number Diff line change
Expand Up @@ -949,9 +949,7 @@ function fromListPartial(n, list, hasStrings) {
ret = list.shift();
} else {
// result spans more than one buffer
ret = (hasStrings ?
copyFromBufferString(n, list) :
copyFromBuffer(n, list));
ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
}
return ret;
}
Expand Down
5 changes: 2 additions & 3 deletions lib/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@

'use strict';

module.exports = ('NODE_UNIQUE_ID' in process.env) ?
require('internal/cluster/child') :
require('internal/cluster/master');
const childOrMaster = 'NODE_UNIQUE_ID' in process.env ? 'child' : 'master';
module.exports = require(`internal/cluster/${childOrMaster}`);
5 changes: 2 additions & 3 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1357,9 +1357,8 @@ function FSWatcher() {
if (status < 0) {
self._handle.close();
const error = !filename ?
errnoException(status, 'Error watching file for changes:') :
errnoException(status,
`Error watching file ${filename} for changes:`);
errnoException(status, 'Error watching file for changes:') :
errnoException(status, `Error watching file ${filename} for changes:`);
error.filename = filename;
self.emit('error', error);
} else {
Expand Down
6 changes: 3 additions & 3 deletions lib/internal/bootstrap_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,9 +275,9 @@
enumerable: true,
get: function() {
if (!console) {
console = originalConsole === undefined ?
NativeModule.require('console') :
installInspectorConsole(originalConsole);
console = (originalConsole === undefined) ?
NativeModule.require('console') :
installInspectorConsole(originalConsole);
}
return console;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -883,8 +883,8 @@ function _validateStdio(stdio, sync) {
} else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) ||
getHandleWrapType(stdio._handle)) {
var handle = getHandleWrapType(stdio) ?
stdio :
getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;
stdio :
getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;

acc.push({
type: 'wrap',
Expand Down
13 changes: 7 additions & 6 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,10 +395,9 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
this.query = Object.create(null);
}

var firstIdx = (questionIdx !== -1 &&
(hashIdx === -1 || questionIdx < hashIdx) ?
questionIdx :
hashIdx);
const useQuestionIdx =
questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx);
const firstIdx = useQuestionIdx ? questionIdx : hashIdx;
if (firstIdx === -1) {
if (rest.length > 0)
this.pathname = rest;
Expand Down Expand Up @@ -585,9 +584,11 @@ Url.prototype.format = function format() {
if (this.host) {
host = auth + this.host;
} else if (this.hostname) {
host = auth + (this.hostname.indexOf(':') === -1 ?
host = auth + (
this.hostname.indexOf(':') === -1 ?
this.hostname :
'[' + this.hostname + ']');
'[' + this.hostname + ']'
);
if (this.port) {
host += ':' + this.port;
}
Expand Down