(
search?: string | number | {[key: string]: unknown},
paramValue?: null | undefined | string | number | boolean | string[],
)
| 657 | paramValue: null | undefined | string | number | boolean | string[], |
| 658 | ): this; |
| 659 | search( |
| 660 | search?: string | number | {[key: string]: unknown}, |
| 661 | paramValue?: null | undefined | string | number | boolean | string[], |
| 662 | ): {[key: string]: unknown} | this { |
| 663 | switch (arguments.length) { |
| 664 | case 0: |
| 665 | return this.$$search; |
| 666 | case 1: |
| 667 | if (typeof search === 'string' || typeof search === 'number') { |
| 668 | this.$$search = this.urlCodec.decodeSearch(search.toString()); |
| 669 | } else if (typeof search === 'object' && search !== null) { |
| 670 | // Copy the object so it's never mutated |
| 671 | search = {...search}; |
| 672 | // remove object undefined or null properties |
| 673 | for (const key in search) { |
| 674 | if (search[key] == null) delete search[key]; |
| 675 | } |
| 676 | |
| 677 | this.$$search = search; |
| 678 | } else { |
| 679 | throw new Error( |
| 680 | 'LocationProvider.search(): First argument must be a string or an object.', |
| 681 | ); |
| 682 | } |
| 683 | break; |
| 684 | default: |
| 685 | if (typeof search === 'string') { |
| 686 | const currentSearch = this.search(); |
| 687 | if (typeof paramValue === 'undefined' || paramValue === null) { |
| 688 | delete currentSearch[search]; |
| 689 | return this.search(currentSearch); |
| 690 | } else { |
| 691 | currentSearch[search] = paramValue; |
| 692 | return this.search(currentSearch); |
| 693 | } |
| 694 | } |
| 695 | } |
| 696 | this.composeUrls(); |
| 697 | return this; |
| 698 | } |
| 699 | |
| 700 | /** |
| 701 | * Retrieves the current hash fragment, or changes the hash fragment and returns a reference to |
no test coverage detected