Browse Source

lib: update indentation of ternaries

In preparation for stricter indentation linting and to increase code
clarity, update indentation for ternaries in lib.

Backport-PR-URL: https://github.com/nodejs/node/pull/14835
PR-URL: https://github.com/nodejs/node/pull/14247
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Rich Trott 8 years ago
committed by Myles Borins
parent
commit
963ea0e99b
No known key found for this signature in database GPG Key ID: 933B01F40B5CA946
  1. 4
      lib/events.js
  2. 1
      lib/internal/freelist.js
  3. 10
      lib/url.js

4
lib/events.js

@ -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) {

1
lib/internal/freelist.js

@ -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);

10
lib/url.js

@ -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();
@ -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();

Loading…
Cancel
Save