Skip to content

Commit 5ab3ca4

Browse files
trivikrMylesBorins
authored andcommitted
url: declare iterator inside loop
Refs: #30281 (comment) PR-URL: #30509 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]>
1 parent 5f42b1f commit 5ab3ca4

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

lib/url.js

+3-4
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
166166
let end = -1;
167167
let rest = '';
168168
let lastPos = 0;
169-
let i = 0;
170-
for (let inWs = false, split = false; i < url.length; ++i) {
169+
for (let i = 0, inWs = false, split = false; i < url.length; ++i) {
171170
const code = url.charCodeAt(i);
172171

173172
// Find first and last non-whitespace characters for trimming
@@ -299,7 +298,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
299298
let hostEnd = -1;
300299
let atSign = -1;
301300
let nonHost = -1;
302-
for (i = 0; i < rest.length; ++i) {
301+
for (let i = 0; i < rest.length; ++i) {
303302
switch (rest.charCodeAt(i)) {
304303
case CHAR_TAB:
305304
case CHAR_LINE_FEED:
@@ -415,7 +414,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
415414

416415
let questionIdx = -1;
417416
let hashIdx = -1;
418-
for (i = 0; i < rest.length; ++i) {
417+
for (let i = 0; i < rest.length; ++i) {
419418
const code = rest.charCodeAt(i);
420419
if (code === CHAR_HASH) {
421420
this.hash = rest.slice(i);

0 commit comments

Comments
 (0)