Skip to content

Commit

Permalink
Improve query conversion logic (vercel#15236)
Browse files Browse the repository at this point in the history
`URLSearchParams` has a `forEach` method. this should simplify and shorten the logic. Perhaps it will even phix vercel#15232
  • Loading branch information
Janpot authored Jul 16, 2020
1 parent f00ad58 commit dad3299
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function searchParamsToUrlQuery(
searchParams: URLSearchParams
): ParsedUrlQuery {
const query: ParsedUrlQuery = {}
Array.from(searchParams.entries()).forEach(([key, value]) => {
searchParams.forEach((value, key) => {
if (typeof query[key] === 'undefined') {
query[key] = value
} else if (Array.isArray(query[key])) {
Expand Down

0 comments on commit dad3299

Please sign in to comment.