summaryrefslogtreecommitdiff
path: root/lib/url.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2017-07-04 17:59:36 -0700
committerRich Trott <rtrott@gmail.com>2017-07-07 06:57:16 -0700
commit85dacd63f0938cf135d49d393ceb9e85b4b1fac5 (patch)
tree0424c7e9ce9b1ac3ed43ad6dc4b349e7a00e2e5c /lib/url.js
parent8f3dab4b63f48a0ebca5c40e054a0e8abc982866 (diff)
downloadandroid-node-v8-85dacd63f0938cf135d49d393ceb9e85b4b1fac5.tar.gz
android-node-v8-85dacd63f0938cf135d49d393ceb9e85b4b1fac5.tar.bz2
android-node-v8-85dacd63f0938cf135d49d393ceb9e85b4b1fac5.zip
lib: use consistent indentation for ternaries
In anticipation of stricter linting for indentation issues, modify ternary operators in lib that do not conform with the expected ESLint settings. PR-URL: https://github.com/nodejs/node/pull/14078 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r--lib/url.js13
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/url.js b/lib/url.js
index b3b05f4a89..70584f8d07 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -395,10 +395,9 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
this.query = Object.create(null);
}
- var firstIdx = (questionIdx !== -1 &&
- (hashIdx === -1 || questionIdx < hashIdx) ?
- questionIdx :
- hashIdx);
+ const useQuestionIdx =
+ questionIdx !== -1 && (hashIdx === -1 || questionIdx < hashIdx);
+ const firstIdx = useQuestionIdx ? questionIdx : hashIdx;
if (firstIdx === -1) {
if (rest.length > 0)
this.pathname = rest;
@@ -585,9 +584,11 @@ Url.prototype.format = function format() {
if (this.host) {
host = auth + this.host;
} else if (this.hostname) {
- host = auth + (this.hostname.indexOf(':') === -1 ?
+ host = auth + (
+ this.hostname.indexOf(':') === -1 ?
this.hostname :
- '[' + this.hostname + ']');
+ '[' + this.hostname + ']'
+ );
if (this.port) {
host += ':' + this.port;
}