Skip to content
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fixup! refactor delete method one loop into two for better readability
  • Loading branch information
sankalp1999 committed May 8, 2023
commit f1845e3167245f690a640db8d22c7f8f4f9e8772
15 changes: 7 additions & 8 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -450,18 +450,17 @@ class URLSearchParams {
value = toUSVString(value);
}

for (let i = 0; i < list.length;) {
if (value !== undefined) {
const key = list[i];
const val = list[i + 1];
if (key === name && val === value) {
if (value !== undefined) {
for (let i = 0; i < list.length;) {
if (list[i] === name && list[i + 1] === value) {
list.splice(i, 2);
} else {
i += 2;
}
} else {
const cur = list[i];
if (cur === name) {
}
} else {
for (let i = 0; i < list.length;) {
if (list[i] === name) {
list.splice(i, 2);
} else {
i += 2;
Expand Down