Is there a shorter / cleaner way of creating a plain object from URLSearchParams
than this:
const uri = new URL('https://tempuri.org/?token=secret&test=true')
const result = {}
for (let p of uri.searchParams) {
result[p[0]] = p[1]
}
Expected result:
{ token: 'secret', test: 'true' }