Skip to content

Commit c915e9f

Browse files
committed
lib: update indentation of ternaries
In preparation for stricter indentation linting and to increase code clarity, update indentation for ternaries in lib.
1 parent 785a9e5 commit c915e9f

File tree

4 files changed

+11
-10
lines changed

4 files changed

+11
-10
lines changed

lib/events.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ function _addListener(target, type, listener, prepend) {
262262
} else {
263263
if (typeof existing === 'function') {
264264
// Adding the second element, need to change to array.
265-
existing = events[type] = prepend ? [listener, existing] :
266-
[existing, listener];
265+
existing = events[type] =
266+
prepend ? [listener, existing] : [existing, listener];
267267
} else {
268268
// If we've already got an array, just append.
269269
if (prepend) {

lib/internal/freelist.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ class FreeList {
99
}
1010

1111
alloc() {
12-
return this.list.length ? this.list.pop() :
13-
this.ctor.apply(this, arguments);
12+
return this.list.length ?
13+
this.list.pop() :
14+
this.ctor.apply(this, arguments);
1415
}
1516

1617
free(obj) {

lib/net.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ function createHandle(fd) {
6464

6565
function getNewAsyncId(handle) {
6666
return (!handle || typeof handle.getAsyncId !== 'function') ?
67-
newUid() : handle.getAsyncId();
67+
newUid() : handle.getAsyncId();
6868
}
6969

7070

lib/url.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -827,8 +827,8 @@ Url.prototype.resolveObject = function resolveObject(relative) {
827827
//occasionally the auth can get stuck only in host
828828
//this especially happens in cases like
829829
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
830-
const authInHost = result.host && result.host.indexOf('@') > 0 ?
831-
result.host.split('@') : false;
830+
const authInHost =
831+
result.host && result.host.indexOf('@') > 0 && result.host.split('@');
832832
if (authInHost) {
833833
result.auth = authInHost.shift();
834834
result.host = result.hostname = authInHost.shift();
@@ -904,13 +904,13 @@ Url.prototype.resolveObject = function resolveObject(relative) {
904904

905905
// put the host back
906906
if (noLeadingSlashes) {
907-
result.hostname = result.host = isAbsolute ? '' :
908-
srcPath.length ? srcPath.shift() : '';
907+
result.hostname =
908+
result.host = isAbsolute ? '' : srcPath.length ? srcPath.shift() : '';
909909
//occasionally the auth can get stuck only in host
910910
//this especially happens in cases like
911911
//url.resolveObject('mailto:local1@domain1', 'local2@domain2')
912912
const authInHost = result.host && result.host.indexOf('@') > 0 ?
913-
result.host.split('@') : false;
913+
result.host.split('@') : false;
914914
if (authInHost) {
915915
result.auth = authInHost.shift();
916916
result.host = result.hostname = authInHost.shift();

0 commit comments

Comments
 (0)