(url, options)
| 680 | } |
| 681 | |
| 682 | export function parseUrl(url, options) { |
| 683 | options = { |
| 684 | decode: true, |
| 685 | ...definedOptions(options), |
| 686 | }; |
| 687 | |
| 688 | // Leading and trailing whitespace is ignored, like `parse()` does for the query and the URL parser does for the whole URL. Otherwise a newline from pasted input would end up in `fragmentIdentifier`. |
| 689 | url = url.trim(); |
| 690 | |
| 691 | let [url_, hash] = splitOnFirst(url, '#'); |
| 692 | |
| 693 | if (url_ === undefined) { |
| 694 | url_ = url; |
| 695 | } |
| 696 | |
| 697 | return { |
| 698 | url: getUrlWithoutQuery(url_), |
| 699 | query: parse(extract(url), options), |
| 700 | ...(options.parseFragmentIdentifier && hash && {fragmentIdentifier: decode(hash, options)}), |
| 701 | }; |
| 702 | } |
| 703 | |
| 704 | export function stringifyUrl(object, options) { |
| 705 | options = { |
no test coverage detected