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

Function portFromOrigin

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

Source from the content-addressed store, hash-verified

2887 });
2888
2889const portFromOrigin = (origin: string): number | null => {
2890 try {
2891 const url = new URL(origin);
2892 if (!url.port) return url.protocol === "https:" ? 443 : 80;
2893 const port = Number.parseInt(url.port, 10);
2894 return Number.isInteger(port) && port > 0 ? port : null;
2895 } catch {
2896 return null;
2897 }
2898};
2899
2900const servicePortOption = () =>
2901 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected