Skip to content

Instantly share code, notes, and snippets.

@ehgoodenough
Created June 12, 2015 14:36
Show Gist options
  • Save ehgoodenough/839dd2c85e5f78cf2f84 to your computer and use it in GitHub Desktop.
Save ehgoodenough/839dd2c85e5f78cf2f84 to your computer and use it in GitHub Desktop.
var generateURL = function(target, params) {
if(typeof target != "string") {
target = target.join("/")
}
if(typeof params != "string") {
params = Object.keys(params).map(function(key) {
return key + "=" + params[key]
}).join("&")
}
return target + "?" + params
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment