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

Function portFromOrigin

apps/cli/src/main.ts:2781–2790  ·  view source on GitHub ↗
(origin: string)

Source from the content-addressed store, hash-verified

2779 });
2780
2781const portFromOrigin = (origin: string): number | null => {
2782 try {
2783 const url = new URL(origin);
2784 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2785 const port = Number.parseInt(url.port, 10);
2786 return Number.isInteger(port) && port > 0 ? port : null;
2787 } catch {
2788 return null;
2789 }
2790};
2791
2792const servicePortOption = () =>
2793 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected