Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Matir committed Oct 28, 2024
1 parent e3d6483 commit 43fdc70
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions src/core/operations/ExtractURI.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,27 @@ class ExtractURI extends Operation {
const uri = new URL(input);
const pieces = {};
// Straight copy some attributes
['protocol', 'hostname', 'port', 'username', 'password', 'pathname', 'hash'
].forEach((name) => {
if (uri[name]) pieces[name] = uri[name];
[
"hash",
"hostname",
"password",
"pathname",
"port",
"protocol",
"username"
].forEach((name) => {
if (uri[name]) pieces[name] = uri[name];
});
// Now handle query params
const params = uri.searchParams;
if (params.size) {
pieces['query'] = {};
pieces.query = {};
for (const name of params.keys()) {
const values = params.getAll(name);
if (values.length > 1) {
pieces['query'][name] = values;
pieces.query[name] = values;
} else {
pieces['query'][name] = values[0];
pieces.query[name] = values[0];
}
}
}
Expand Down

0 comments on commit 43fdc70

Please sign in to comment.