MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / canonicalResource

Function canonicalResource

apps/local/src/db/v1-v2-migration.ts:378–385  ·  view source on GitHub ↗
(value: string)

Source from the content-addressed store, hash-verified

376};
377
378const canonicalResource = (value: string): string | null => {
379 try {
380 const url = new URL(value);
381 return `${url.protocol.toLowerCase()}//${url.host.toLowerCase()}${url.pathname.replace(/\/+$/, "")}`;
382 } catch {
383 return null;
384 }
385};
386
387const resourceMatchesEndpoint = (resource: string, endpoint: string): boolean => {
388 const actual = canonicalResource(resource);

Callers 1

resourceMatchesEndpointFunction · 0.85

Calls 1

replaceMethod · 0.65

Tested by

no test coverage detected