(object, options)
| 551 | } |
| 552 | |
| 553 | export function stringifyUrl(object, options) { |
| 554 | options = { |
| 555 | encode: true, |
| 556 | strict: true, |
| 557 | [encodeFragmentIdentifier]: true, |
| 558 | ...options, |
| 559 | }; |
| 560 | |
| 561 | const url = getUrlWithoutQuery(removeHash(object.url)) || ''; |
| 562 | const queryFromUrl = extract(object.url); |
| 563 | |
| 564 | const query = { |
| 565 | ...parse(queryFromUrl, {sort: false, ...options}), |
| 566 | ...object.query, |
| 567 | }; |
| 568 | |
| 569 | let queryString = stringify(query, options); |
| 570 | queryString &&= `?${queryString}`; |
| 571 | |
| 572 | let hash = getHash(object.url); |
| 573 | if (typeof object.fragmentIdentifier === 'string') { |
| 574 | const urlObjectForFragmentEncode = new URL(url, 'https://query-string.invalid'); |
| 575 | urlObjectForFragmentEncode.hash = object.fragmentIdentifier; |
| 576 | hash = options[encodeFragmentIdentifier] ? urlObjectForFragmentEncode.hash : `#${object.fragmentIdentifier}`; |
| 577 | } |
| 578 | |
| 579 | return `${url}${queryString}${hash}`; |
| 580 | } |
| 581 | |
| 582 | export function pick(input, filter, options) { |
| 583 | options = { |
no test coverage detected
searching dependent graphs…