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

Function canParseOrigin

packages/react/src/api/server-profiles.tsx:57–62  ·  view source on GitHub ↗
(origin: string | undefined)

Source from the content-addressed store, hash-verified

55const hasHttpScheme = (value: string): boolean => /^https?:\/\//.test(value.trim());
56
57const canParseOrigin = (origin: string | undefined): boolean => {
58 if (origin === undefined) return true;
59 const trimmed = origin.trim();
60 if (!trimmed) return true;
61 return URL.canParse(hasHttpScheme(trimmed) ? trimmed : `http://${trimmed}`);
62};
63
64const canParseApiBaseUrl = (apiBaseUrl: string | undefined): boolean => {
65 if (apiBaseUrl === undefined) return true;

Callers 1

Calls 1

hasHttpSchemeFunction · 0.85

Tested by

no test coverage detected