(url: string)
| 6 | } |
| 7 | |
| 8 | export function splitUrl(url: string): { |
| 9 | path: string |
| 10 | query: string |
| 11 | fragment: string |
| 12 | } { |
| 13 | const hashIdx = url.indexOf('#') |
| 14 | const fragment = hashIdx === -1 ? '' : url.slice(hashIdx) |
| 15 | const beforeHash = hashIdx === -1 ? url : url.slice(0, hashIdx) |
| 16 | const qIdx = beforeHash.indexOf('?') |
| 17 | const path = qIdx === -1 ? beforeHash : beforeHash.slice(0, qIdx) |
| 18 | const query = qIdx === -1 ? '' : beforeHash.slice(qIdx + 1) |
| 19 | return { path, query, fragment } |
| 20 | } |
| 21 | |
| 22 | function combineUrl(parts: { |
| 23 | path: string |
no outgoing calls
no test coverage detected