(str: string)
| 25 | * const search = useSearch({ from: '/your-route' }); |
| 26 | */ |
| 27 | export const queryToObj = (str: string) => { |
| 28 | const query = new URLSearchParams(str); |
| 29 | const obj = {} as Record<string, string>; |
| 30 | for (const [k, v] of query.entries()) { |
| 31 | obj[k] = v; |
| 32 | } |
| 33 | |
| 34 | return obj; |
| 35 | }; |
| 36 | |
| 37 | /** |
| 38 | * Converts an object to a URL query string. |
no outgoing calls
no test coverage detected
searching dependent graphs…