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

Function portFromOrigin

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

Source from the content-addressed store, hash-verified

3004 });
3005
3006const portFromOrigin = (origin: string): number | null => {
3007 try {
3008 const url = new URL(origin);
3009 if (!url.port) return url.protocol === "https:" ? 443 : 80;
3010 const port = Number.parseInt(url.port, 10);
3011 return Number.isInteger(port) && port > 0 ? port : null;
3012 } catch {
3013 return null;
3014 }
3015};
3016
3017const servicePortOption = () =>
3018 Options.integer("port")

Callers 2

installServiceFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected