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

Function portFromOrigin

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

Source from the content-addressed store, hash-verified

2858 });
2859
2860const portFromOrigin = (origin: string): number | null => {
2861 try {
2862 const url = new URL(origin);
2863 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2864 const port = Number.parseInt(url.port, 10);
2865 return Number.isInteger(port) && port > 0 ? port : null;
2866 } catch {
2867 return null;
2868 }
2869};
2870
2871const servicePortOption = () =>
2872 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected