lib: update indentation of ternaries
In preparation for stricter indentation linting and to increase code clarity, update indentation for ternaries in lib. 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>
This commit is contained in:
parent
9ab63d61f8
commit
d14c13238b
@ -262,8 +262,8 @@ function _addListener(target, type, listener, prepend) {
|
|||||||
} else {
|
} else {
|
||||||
if (typeof existing === 'function') {
|
if (typeof existing === 'function') {
|
||||||
// Adding the second element, need to change to array.
|
// Adding the second element, need to change to array.
|
||||||
existing = events[type] = prepend ? [listener, existing] :
|
existing = events[type] =
|
||||||
[existing, listener];
|
prepend ? [listener, existing] : [existing, listener];
|
||||||
} else {
|
} else {
|
||||||
// If we've already got an array, just append.
|
// If we've already got an array, just append.
|
||||||
if (prepend) {
|
if (prepend) {
|
||||||
|
@ -9,8 +9,9 @@ class FreeList {
|
|||||||
}
|
}
|
||||||
|
|
||||||
alloc() {
|
alloc() {
|
||||||
return this.list.length ? this.list.pop() :
|
return this.list.length ?
|
||||||
this.ctor.apply(this, arguments);
|
this.list.pop() :
|
||||||
|
this.ctor.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(obj) {
|
free(obj) {
|
||||||
|
@ -64,7 +64,7 @@ function createHandle(fd) {
|
|||||||
|
|
||||||
function getNewAsyncId(handle) {
|
function getNewAsyncId(handle) {
|
||||||
return (!handle || typeof handle.getAsyncId !== 'function') ?
|
return (!handle || typeof handle.getAsyncId !== 'function') ?
|
||||||
newUid() : handle.getAsyncId();
|
newUid() : handle.getAsyncId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
10
lib/url.js
10
lib/url.js
@ -827,8 +827,8 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
|||||||
//occasionally the auth can get stuck only in host
|
//occasionally the auth can get stuck only in host
|
||||||
//this especially happens in cases like
|
//this especially happens in cases like
|
||||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||||
const authInHost = result.host && result.host.indexOf('@') > 0 ?
|
const authInHost =
|
||||||
result.host.split('@') : false;
|
result.host && result.host.indexOf('@') > 0 && result.host.split('@');
|
||||||
if (authInHost) {
|
if (authInHost) {
|
||||||
result.auth = authInHost.shift();
|
result.auth = authInHost.shift();
|
||||||
result.host = result.hostname = authInHost.shift();
|
result.host = result.hostname = authInHost.shift();
|
||||||
@ -904,13 +904,13 @@ Url.prototype.resolveObject = function resolveObject(relative) {
|
|||||||
|
|
||||||
// put the host back
|
// put the host back
|
||||||
if (noLeadingSlashes) {
|
if (noLeadingSlashes) {
|
||||||
result.hostname = result.host = isAbsolute ? '' :
|
result.hostname =
|
||||||
srcPath.length ? srcPath.shift() : '';
|
result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
|
||||||
//occasionally the auth can get stuck only in host
|
//occasionally the auth can get stuck only in host
|
||||||
//this especially happens in cases like
|
//this especially happens in cases like
|
||||||
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
|
||||||
const authInHost = result.host && result.host.indexOf('@') > 0 ?
|
const authInHost = result.host && result.host.indexOf('@') > 0 ?
|
||||||
result.host.split('@') : false;
|
result.host.split('@') : false;
|
||||||
if (authInHost) {
|
if (authInHost) {
|
||||||
result.auth = authInHost.shift();
|
result.auth = authInHost.shift();
|
||||||
result.host = result.hostname = authInHost.shift();
|
result.host = result.hostname = authInHost.shift();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user