Skip to content

Commit

Permalink
lib: update indentation of ternaries
Browse files Browse the repository at this point in the history
In preparation for stricter indentation linting and to increase code
clarity, update indentation for ternaries in lib.

Backport-PR-URL: #14835
PR-URL: #14247
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Joyee Cheung <[email protected]>
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Tobias Nießen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
Trott authored and MylesBorins committed Aug 16, 2017
1 parent a75ba80 commit 5ef17b7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
4 changes: 2 additions & 2 deletions lib/events.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,8 @@ function _addListener(target, type, listener, prepend) {
} else {
if (typeof existing === 'function') {
// Adding the second element, need to change to array.
existing = events[type] = prepend ? [listener, existing] :
[existing, listener];
existing = events[type] =
prepend ? [listener, existing] : [existing, listener];
} else {
// If we've already got an array, just append.
if (prepend) {
Expand Down
1 change: 0 additions & 1 deletion lib/internal/freelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ exports.FreeList = function(name, max, constructor) {
this.list = [];
};


exports.FreeList.prototype.alloc = function() {
return this.list.length ? this.list.pop() :
this.constructor.apply(this, arguments);
Expand Down
10 changes: 5 additions & 5 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,8 @@ Url.prototype.resolveObject = function(relative) {
//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;
const authInHost =
result.host && result.host.indexOf('@') > 0 && result.host.split('@');
if (authInHost) {
result.auth = authInHost.shift();
result.host = result.hostname = authInHost.shift();
Expand Down Expand Up @@ -882,13 +882,13 @@ Url.prototype.resolveObject = function(relative) {

// put the host back
if (noLeadingSlashes) {
result.hostname = result.host = isAbsolute ? '' :
srcPath.length ? srcPath.shift() : '';
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')
const authInHost = result.host && result.host.indexOf('@') > 0 ?
result.host.split('@') : false;
result.host.split('@') : false;
if (authInHost) {
result.auth = authInHost.shift();
result.host = result.hostname = authInHost.shift();
Expand Down

0 comments on commit 5ef17b7

Please sign in to comment.