feat: ignore to compiled link, fixed #203 (#204)

* feat: ignore to compiled link, fixed #203

* feat: add noCompileLinks, fixed #203

* fix: remove test code
This commit is contained in:
cinwell.li 2017-07-10 22:38:26 +08:00 • committed by GitHub
commit 2e00f4c993
9 changed files with 156 additions and 4 deletions

View file

@ -16,8 +16,9 @@ export function parseQuery (query) {
query.split('&').forEach(function (param) {
const parts = param.replace(/\+/g, ' ').split('=')
res[parts[0]] = decode(parts[1])
res[parts[0]] = parts[1] && decode(parts[1])
})
return res
}
@ -25,7 +26,9 @@ export function stringifyQuery (obj) {
const qs = []
for (const key in obj) {
qs.push(`${encode(key)}=${encode(obj[key])}`.toLowerCase())
qs.push(obj[key]
? `${encode(key)}=${encode(obj[key])}`.toLowerCase()
: encode(key))
}
return qs.length ? `?${qs.join('&')}` : ''