(url: string, qs: string)
| 22 | * Join querystring to URL |
| 23 | */ |
| 24 | export const joinUrlAndQueryString = (url: string, qs: string) => { |
| 25 | if (!qs) { |
| 26 | return url; |
| 27 | } |
| 28 | if (!url) { |
| 29 | return qs; |
| 30 | } |
| 31 | const [base, ...hashes] = url.split('#'); |
| 32 | // TODO: Make this work with URLs that have a #hash component |
| 33 | const baseUrl = base || ''; |
| 34 | const joiner = getJoiner(base); |
| 35 | const hash = hashes.length ? `#${hashes.join('#')}` : ''; |
| 36 | return `${baseUrl}${joiner}${qs}${hash}`; |
| 37 | }; |
| 38 | |
| 39 | /** |
| 40 | * Extract querystring from URL |
no test coverage detected