Skip to content

Commit

Permalink
refactor: simpler buildURL method
Browse files Browse the repository at this point in the history
  • Loading branch information
nicosantangelo committed Oct 14, 2021
1 parent f5c9f95 commit b162870
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions spec/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,12 @@ export const wallet: Wallet = {
},
}

export function buildURL(uri: string, queryString?: Record<string, string>) {
export function buildURL(
uri: string,
queryString: Record<string, string> = {}
) {
const API_VERSION = env.get('API_VERSION', 'v1')
const search = queryString ? buildSearch(queryString) : ''
return `/${API_VERSION}${uri}${search}`
return `/${API_VERSION}${uri}${buildSearch(queryString)}`
}

export function buildSearch(queryString: Record<string, string>) {
Expand Down

0 comments on commit b162870

Please sign in to comment.