MCPcopy
hub / github.com/obytes/react-native-template-obytes / getUrlParameters

Function getUrlParameters

src/lib/api/utils.tsx:30–46  ·  view source on GitHub ↗
(
  url: string | null,
)

Source from the content-addressed store, hash-verified

28
29// a function that accept a url and return params as an object
30export function getUrlParameters(
31 url: string | null,
32): { [k: string]: string } | null {
33 if (url === null) {
34 return null;
35 }
36 const regex = /[?&]([^=#]+)=([^&#]*)/g;
37 const params = {};
38 let match;
39 while ((match = regex.exec(url))) {
40 if (match[1] !== null) {
41 // @ts-expect-error - Dynamic key assignment
42 params[match[1]] = match[2];
43 }
44 }
45 return params;
46}
47
48export const getPreviousPageParam: GetNextPageParamFunction<
49 unknown,

Callers 2

getPreviousPageParamFunction · 0.85
getNextPageParamFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected