MCPcopy Create free account
hub / github.com/47ng/nuqs / filterQueryKeys

Function filterQueryKeys

packages/docs/src/components/querystring.tsx:65–77  ·  view source on GitHub ↗
(query: string | URLSearchParams, keys?: string[])

Source from the content-addressed store, hash-verified

63}
64
65function filterQueryKeys(query: string | URLSearchParams, keys?: string[]) {
66 const source = new URLSearchParams(query)
67 if (!keys || keys.length === 0) {
68 return source
69 }
70 const destination = new URLSearchParams()
71 for (const [key, value] of source.entries()) {
72 if (keys.includes(key)) {
73 destination.append(key, value)
74 }
75 }
76 return destination
77}

Callers 1

QuerystringFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected