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

Function getPathnameWithQuery

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

Source from the content-addressed store, hash-verified

138};
139
140export const getPathnameWithQuery = (
141 pathname: string,
142 params: URLSearchParams | string,
143): string => {
144 const [basePath, existingQuery] = pathname.split('?');
145 const merged = new URLSearchParams(existingQuery?.trim());
146 const overrides = new URLSearchParams(params);
147 overrides.forEach((value, key) => {
148 merged.set(key, value);
149 });
150 const queryString = merged.toString();
151
152 return `${basePath}${queryString ? `?${queryString}` : ''}`;
153};
154
155// For hrefs that must reach the webapp whoever renders them: on the extension
156// 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