diff options
author | Ruben Bridgewater <ruben@bridgewater.de> | 2019-03-26 05:21:27 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-03-30 13:16:39 +0100 |
commit | f86f5736da72ad4f3fb50692461222590e2f0258 (patch) | |
tree | 6fee263bfca24abbf76b7a3f1517b8184c29f077 /lib/url.js | |
parent | f0b3855a90bc5f68fe38ea5e7c69d30ae7d81a27 (diff) | |
download | android-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.tar.gz android-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.tar.bz2 android-node-v8-f86f5736da72ad4f3fb50692461222590e2f0258.zip |
benchmark,lib: change var to const
Refs: https://github.com/nodejs/node/pull/26679
PR-URL: https://github.com/nodejs/node/pull/26915
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'lib/url.js')
-rw-r--r-- | lib/url.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/url.js b/lib/url.js index fba5558edb..eb60fe477f 100644 --- a/lib/url.js +++ b/lib/url.js @@ -145,7 +145,7 @@ let querystring; function urlParse(url, parseQueryString, slashesDenoteHost) { if (url instanceof Url) return url; - var urlObject = new Url(); + const urlObject = new Url(); urlObject.parse(url, parseQueryString, slashesDenoteHost); return urlObject; } @@ -674,8 +674,8 @@ Url.prototype.resolveObject = function resolveObject(relative) { relative = rel; } - var result = new Url(); - var tkeys = Object.keys(this); + const result = new Url(); + const tkeys = Object.keys(this); for (var tk = 0; tk < tkeys.length; tk++) { var tkey = tkeys[tk]; result[tkey] = this[tkey]; @@ -761,16 +761,16 @@ Url.prototype.resolveObject = function resolveObject(relative) { return result; } - var isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'); - var isRelAbs = ( + const isSourceAbs = (result.pathname && result.pathname.charAt(0) === '/'); + const isRelAbs = ( relative.host || relative.pathname && relative.pathname.charAt(0) === '/' ); var mustEndAbs = (isRelAbs || isSourceAbs || (result.host && relative.pathname)); - var removeAllDots = mustEndAbs; + const removeAllDots = mustEndAbs; var srcPath = result.pathname && result.pathname.split('/') || []; - var relPath = relative.pathname && relative.pathname.split('/') || []; - var noLeadingSlashes = result.protocol && + const relPath = relative.pathname && relative.pathname.split('/') || []; + const noLeadingSlashes = result.protocol && !slashedProtocol.has(result.protocol); // If the url is a non-slashed url, then relative @@ -866,7 +866,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { // however, if it ends in anything else non-slashy, // then it must NOT get a trailing slash. var last = srcPath.slice(-1)[0]; - var hasTrailingSlash = ( + const hasTrailingSlash = ( (result.host || relative.host || srcPath.length > 1) && (last === '.' || last === '..') || last === ''); @@ -902,7 +902,7 @@ Url.prototype.resolveObject = function resolveObject(relative) { srcPath.push(''); } - var isAbsolute = srcPath[0] === '' || + const isAbsolute = srcPath[0] === '' || (srcPath[0] && srcPath[0].charAt(0) === '/'); // put the host back |