Skip to content

Instantly share code, notes, and snippets.

@hardboiled
Created December 10, 2018 15:03
Show Gist options
  • Save hardboiled/5583e675d9d3f7f6436f520fba28a810 to your computer and use it in GitHub Desktop.
Save hardboiled/5583e675d9d3f7f6436f520fba28a810 to your computer and use it in GitHub Desktop.
function serializeParamsIntoUrl(baseUrl: string, params: any) {
let queryParams = []
for (let key in params) {
queryParams.push(`${key}=${params[key]}`)
}
baseUrl += (baseUrl.indexOf('?') < 0) ? '?' : ''
return baseUrl + queryParams.join('&')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment