Fix lint issues

This commit is contained in:
David Tomaschik 2024-10-28 12:02:19 -07:00
parent e3d6483ab5
commit 43fdc70d06

View file

@ -34,20 +34,27 @@ class ExtractURI extends Operation {
const uri = new URL(input); const uri = new URL(input);
const pieces = {}; const pieces = {};
// Straight copy some attributes // Straight copy some attributes
['protocol', 'hostname', 'port', 'username', 'password', 'pathname', 'hash' [
"hash",
"hostname",
"password",
"pathname",
"port",
"protocol",
"username"
].forEach((name) => { ].forEach((name) => {
if (uri[name]) pieces[name] = uri[name]; if (uri[name]) pieces[name] = uri[name];
}); });
// Now handle query params // Now handle query params
const params = uri.searchParams; const params = uri.searchParams;
if (params.size) { if (params.size) {
pieces['query'] = {}; pieces.query = {};
for (const name of params.keys()) { for (const name of params.keys()) {
const values = params.getAll(name); const values = params.getAll(name);
if (values.length > 1) { if (values.length > 1) {
pieces['query'][name] = values; pieces.query[name] = values;
} else { } else {
pieces['query'][name] = values[0]; pieces.query[name] = values[0];
} }
} }
} }