Skip to content

Commit 70dc7a2

Browse files
trivikrtargos
authored andcommitted
url: declare iterator inside loop
Refs: #30281 (comment) PR-URL: #30509 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent cd740a2 commit 70dc7a2

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

‎lib/url.js‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
162162
letend=-1;
163163
letrest='';
164164
letlastPos=0;
165-
leti=0;
166-
for(letinWs=false,split=false;i<url.length;++i){
165+
for(leti=0,inWs=false,split=false;i<url.length;++i){
167166
constcode=url.charCodeAt(i);
168167

169168
// Find first and last non-whitespace characters for trimming
@@ -295,7 +294,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
295294
lethostEnd=-1;
296295
letatSign=-1;
297296
letnonHost=-1;
298-
for(i=0;i<rest.length;++i){
297+
for(leti=0;i<rest.length;++i){
299298
switch(rest.charCodeAt(i)){
300299
caseCHAR_TAB:
301300
caseCHAR_LINE_FEED:
@@ -411,7 +410,7 @@ Url.prototype.parse = function parse(url, parseQueryString, slashesDenoteHost) {
411410

412411
letquestionIdx=-1;
413412
lethashIdx=-1;
414-
for(i=0;i<rest.length;++i){
413+
for(leti=0;i<rest.length;++i){
415414
constcode=rest.charCodeAt(i);
416415
if(code===CHAR_HASH){
417416
this.hash=rest.slice(i);

0 commit comments

Comments
 (0)