Skip to content

Commit

Permalink
fix: getParams object keys
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Dec 12, 2020
1 parent 40a6ab3 commit 72bcdf2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export function withParams (input: InputURL, params: SearchParams): string {
export function getParams (input: InputURL): SearchParams {
const parsed = parseURL(input)
const params: SearchParams = {}
parsed.url.searchParams.forEach((value, key) => { params[value] = key })
parsed.url.searchParams.forEach((value, key) => { params[key] = value })
return params
}

Expand Down
2 changes: 1 addition & 1 deletion test/params.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe('withParams', () => {

describe('getParams', () => {
const tests = {
'http://foo.com/foo?test=123&unicode=%E5%A5%BD': { 123: 'test', : 'unicode' }
'http://foo.com/foo?test=123&unicode=%E5%A5%BD': { test: '123', unicode: '' }
}

for (const t in tests) {
Expand Down

0 comments on commit 72bcdf2

Please sign in to comment.