From 963ea0e99b62c7a1d58d55ff44a278a94505a6c1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 14 Jul 2017 21:00:36 -0700 Subject: [PATCH] lib: update indentation of ternaries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-By: Luigi Pinca Reviewed-By: Joyee Cheung Reviewed-By: Michaël Zasso Reviewed-By: Gibson Fahnestock Reviewed-By: Tobias Nießen Reviewed-By: James M Snell --- lib/events.js | 4 ++-- lib/internal/freelist.js | 1 - lib/url.js | 10 +++++----- 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/events.js b/lib/events.js index 74bee55ed3f0d7..75bc7c230295cb 100644 --- a/lib/events.js +++ b/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) { diff --git a/lib/internal/freelist.js b/lib/internal/freelist.js index 580726e8725379..90f5483724e97e 100644 --- a/lib/internal/freelist.js +++ b/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); diff --git a/lib/url.js b/lib/url.js index af96df71f39bdd..ad5e715f063496 100644 --- a/lib/url.js +++ b/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();