summaryrefslogtreecommitdiff
path: root/lib/internal/url.js
diff options
context:
space:
mode:
authorRuben Bridgewater <ruben@bridgewater.de>2019-03-26 05:21:27 +0100
committerMichaël Zasso <targos@protonmail.com>2019-03-30 13:16:39 +0100
commitf86f5736da72ad4f3fb50692461222590e2f0258 (patch)
tree6fee263bfca24abbf76b7a3f1517b8184c29f077 /lib/internal/url.js
parentf0b3855a90bc5f68fe38ea5e7c69d30ae7d81a27 (diff)
downloadandroid-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/internal/url.js')
-rw-r--r--lib/internal/url.js26
1 files changed, 13 insertions, 13 deletions
diff --git a/lib/internal/url.js b/lib/internal/url.js
index 9bbd80148c..0771dab13a 100644
--- a/lib/internal/url.js
+++ b/lib/internal/url.js
@@ -192,19 +192,19 @@ class URLSearchParams {
if (typeof recurseTimes === 'number' && recurseTimes < 0)
return ctx.stylize('[Object]', 'special');
- var separator = ', ';
- var innerOpts = { ...ctx };
+ const separator = ', ';
+ const innerOpts = { ...ctx };
if (recurseTimes !== null) {
innerOpts.depth = recurseTimes - 1;
}
- var innerInspect = (v) => inspect(v, innerOpts);
+ const innerInspect = (v) => inspect(v, innerOpts);
- var list = this[searchParams];
- var output = [];
+ const list = this[searchParams];
+ const output = [];
for (var i = 0; i < list.length; i += 2)
output.push(`${innerInspect(list[i])} => ${innerInspect(list[i + 1])}`);
- var length = output.reduce(
+ const length = output.reduce(
(prev, cur) => prev + removeColors(cur).length + separator.length,
-separator.length
);
@@ -220,7 +220,7 @@ class URLSearchParams {
function onParseComplete(flags, protocol, username, password,
host, port, path, query, fragment) {
- var ctx = this[context];
+ const ctx = this[context];
ctx.flags = flags;
ctx.scheme = protocol;
ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';
@@ -343,9 +343,9 @@ class URL {
if (typeof depth === 'number' && depth < 0)
return this;
- var ctor = getConstructorOf(this);
+ const ctor = getConstructorOf(this);
- var obj = Object.create({
+ const obj = Object.create({
constructor: ctor === null ? URL : ctor
});
@@ -1253,7 +1253,7 @@ function domainToUnicode(domain) {
// options object as expected by the http.request and https.request
// APIs.
function urlToOptions(url) {
- var options = {
+ const options = {
protocol: url.protocol,
hostname: typeof url.hostname === 'string' && url.hostname.startsWith('[') ?
url.hostname.slice(1, -1) :
@@ -1276,7 +1276,7 @@ function urlToOptions(url) {
const forwardSlashRegEx = /\//g;
function getPathFromURLWin32(url) {
- var hostname = url.hostname;
+ const hostname = url.hostname;
var pathname = url.pathname;
for (var n = 0; n < pathname.length; n++) {
if (pathname[n] === '%') {
@@ -1315,7 +1315,7 @@ function getPathFromURLPosix(url) {
if (url.hostname !== '') {
throw new ERR_INVALID_FILE_URL_HOST(platform);
}
- var pathname = url.pathname;
+ const pathname = url.pathname;
for (var n = 0; n < pathname.length; n++) {
if (pathname[n] === '%') {
var third = pathname.codePointAt(n + 2) | 0x20;
@@ -1389,7 +1389,7 @@ function toPathIfFileURL(fileURLOrPath) {
function constructUrl(flags, protocol, username, password,
host, port, path, query, fragment) {
- var ctx = new URLContext();
+ const ctx = new URLContext();
ctx.flags = flags;
ctx.scheme = protocol;
ctx.username = (flags & URL_FLAGS_HAS_USERNAME) !== 0 ? username : '';