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‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost){
166166
letend=-1;
167167
letrest='';
168168
letlastPos=0;
169-
leti=0;
170-
for(letinWs=false,split=false;i<url.length;++i){
169+
for(leti=0,inWs=false,split=false;i<url.length;++i){
171170
constcode=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
lethostEnd=-1;
300299
letatSign=-1;
301300
letnonHost=-1;
302-
for(i=0;i<rest.length;++i){
301+
for(leti=0;i<rest.length;++i){
303302
switch(rest.charCodeAt(i)){
304303
caseCHAR_TAB:
305304
caseCHAR_LINE_FEED:
@@ -415,7 +414,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost){
415414

416415
letquestionIdx=-1;
417416
lethashIdx=-1;
418-
for(i=0;i<rest.length;++i){
417+
for(leti=0;i<rest.length;++i){
419418
constcode=rest.charCodeAt(i);
420419
if(code===CHAR_HASH){
421420
this.hash=rest.slice(i);

0 commit comments

Comments
(0)