(origin: string)
| 2858 | }); |
| 2859 | |
| 2860 | const 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 | |
| 2871 | const servicePortOption = () => |
| 2872 | Options.integer("port") |
no outgoing calls
no test coverage detected