summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamat, Trivikram <16024985+trivikr@users.noreply.github.com>2019-11-16 18:51:51 -0800
committerBeth Griggs <Bethany.Griggs@uk.ibm.com>2020-02-06 02:49:07 +0000
commit6d674d476e19dce6441cf794391c7a2d078c3047 (patch)
tree2df486080678d237f647db02396ea78ee38e7a30 /lib
parenta22d5e78e11dedc470ec976693e03fed0ab2068e (diff)
downloadnode-new-6d674d476e19dce6441cf794391c7a2d078c3047.tar.gz
url: declare iterator inside loop
Refs: https://github.com/nodejs/node/pull/30281#discussion_r343380565 PR-URL: https://github.com/nodejs/node/pull/30509 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/url.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/url.js b/lib/url.js
index fc3863f6ef..a7f8fa2203 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -162,8 +162,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
let end = -1;
let rest = '';
let lastPos = 0;
- let i = 0;
- for (let inWs = false, split = false; i < url.length; ++i) {
+ for (let i = 0, inWs = false, split = false; i < url.length; ++i) {
const code = url.charCodeAt(i);
// Find first and last non-whitespace characters for trimming
@@ -295,7 +294,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
let hostEnd = -1;
let atSign = -1;
let nonHost = -1;
- for (i = 0; i < rest.length; ++i) {
+ for (let i = 0; i < rest.length; ++i) {
switch (rest.charCodeAt(i)) {
case CHAR_TAB:
case CHAR_LINE_FEED:
@@ -411,7 +410,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
let questionIdx = -1;
let hashIdx = -1;
- for (i = 0; i < rest.length; ++i) {
+ for (let i = 0; i < rest.length; ++i) {
const code = rest.charCodeAt(i);
if (code === CHAR_HASH) {
this.hash = rest.slice(i);