Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

url: declare iterator inside loop #30509

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,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
Expand Down Expand Up @@ -299,7 +298,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:
Expand Down Expand Up @@ -415,7 +414,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);
Expand Down