Remove ?main from fully-resolved URLs

This commit is contained in:
MICHAEL JACKSON
2017-09-01 22:43:56 -07:00
parent 124fead8ff
commit d3f3aa610c
3 changed files with 23 additions and 19 deletions

View File

@ -0,0 +1,17 @@
function createSearch(query) {
const params = []
Object.keys(query).forEach(function (param) {
if (query[param] === '') {
params.push(param) // Omit the trailing "=" from param=
} else {
params.push(`${param}=${encodeURIComponent(query[param])}`)
}
})
const search = params.join('&')
return search ? `?${search}` : ''
}
module.exports = createSearch