(key: J, value: ArrayOutput[J][number])
| 95 | |
| 96 | // Remove item by key and value |
| 97 | function removeItemByKeyAndValue<J extends ArrayOutputKeys>(key: J, value: ArrayOutput[J][number]) { |
| 98 | const existingValue = parsedQuery[key]; |
| 99 | if (Array.isArray(existingValue) && existingValue.length > 1) { |
| 100 | // @ts-expect-error this is too much for TS it seems |
| 101 | const newValue = existingValue.filter((item) => item !== value); |
| 102 | setQuery(key, newValue); |
| 103 | } else { |
| 104 | // @ts-expect-error this is too much for TS it seems |
| 105 | removeByKey(key); |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | // Remove all query params from the URL |
| 110 | function removeAllQueryParams() { |
no test coverage detected