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

Function getPathnameWithQuery

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

Source from the content-addressed store, hash-verified

143};
144
145export const getPathnameWithQuery = (
146 pathname: string,
147 params: URLSearchParams | string,
148): string => {
149 const [basePath, existingQuery] = pathname.split('?');
150 const merged = new URLSearchParams(existingQuery?.trim());
151 const overrides = new URLSearchParams(params);
152 overrides.forEach((value, key) => {
153 merged.set(key, value);
154 });
155 const queryString = merged.toString();
156
157 return `${basePath}${queryString ? `?${queryString}` : ''}`;
158};
159
160// For hrefs that must reach the webapp whoever renders them: on the extension
161// a root-relative path resolves against `chrome-extension://<id>` and 404s.

Callers 15

PersonalizedDigestFunction · 0.90
OpportunityEditPanelFunction · 0.90
FooterFunction · 0.90
BriefPostContentRawFunction · 0.90
links.spec.tsFile · 0.90
redirectToAppFunction · 0.90
HackathonSignupButtonFunction · 0.90
usePostModalNavigationFunction · 0.90
usePrivateSourceJoinFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected