* Check if `s` looks like a url.
(s: string)
| 346 | */ |
| 347 | |
| 348 | function isURL(s: string) { |
| 349 | try { |
| 350 | const URLObj = new URL(s.trim()) |
| 351 | if (!URLObj.hostname) return false |
| 352 | return true |
| 353 | } catch (e) { |
| 354 | return false |
| 355 | } |
| 356 | } |
| 357 | const parseUrl2QueryParams = (url: string, isCompleteUrl = true) => { |
| 358 | const index = url.indexOf('?') |
| 359 | if (index === -1 && isCompleteUrl) { |