MCPcopy Create free account
hub / github.com/dailydotdev/apps / getPathnameWithQuery

Function getPathnameWithQuery

packages/shared/src/lib/links.ts:120–133  ·  view source on GitHub ↗
(
  pathname: string,
  params: URLSearchParams | string,
)

Source from the content-addressed store, hash-verified

118};
119
120export const getPathnameWithQuery = (
121 pathname: string,
122 params: URLSearchParams | string,
123): string => {
124 const [basePath, existingQuery] = pathname.split('?');
125 const merged = new URLSearchParams(existingQuery?.trim());
126 const overrides = new URLSearchParams(params);
127 overrides.forEach((value, key) => {
128 merged.set(key, value);
129 });
130 const queryString = merged.toString();
131
132 return `${basePath}${queryString ? `?${queryString}` : ''}`;
133};
134
135// For hrefs that must reach the webapp whoever renders them: on the extension
136// a root-relative path resolves against `chrome-extension://<id>` and 404s.

Callers 15

PersonalizedDigestFunction · 0.90
OpportunityEditPanelFunction · 0.90
NavDrawerFunction · 0.90
HeaderFunction · 0.90
FeaturedCoresWidgetFunction · 0.90
BuyCoreFunction · 0.90
FooterFunction · 0.90
BriefPostContentRawFunction · 0.90
links.spec.tsFile · 0.90
redirectToAppFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected