Skip to content

Commit

Permalink
fix: fix types
Browse files Browse the repository at this point in the history
  • Loading branch information
wjw-gavin committed Oct 15, 2023
1 parent f210557 commit 0726a21
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/getUrlAllParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import type { TObject } from './types'
* @param url 指定url,默认 location.href
*/

export function getUrlAllParams(url: string) {
url = url ? url : window.location.href
export function getUrlAllParams(url?: string) {
url = url ? url : decodeURIComponent(window.location.href)
const pa = url.slice(Math.max(0, url.indexOf('?') + 1)),
arr = pa.split('&'),
result: TObject = {}
Expand Down
2 changes: 1 addition & 1 deletion src/getUrlParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* @param url 指定url,默认 location.href
*/

export function getUrlParams(name: string, url: string) {
export function getUrlParams(name: string, url?: string) {
const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`)
let result = null

Expand Down

0 comments on commit 0726a21

Please sign in to comment.