(origin: string)
| 2827 | }); |
| 2828 | |
| 2829 | const portFromOrigin = (origin: string): number | null => { |
| 2830 | try { |
| 2831 | const url = new URL(origin); |
| 2832 | if (!url.port) return url.protocol === "https:" ? 443 : 80; |
| 2833 | const port = Number.parseInt(url.port, 10); |
| 2834 | return Number.isInteger(port) && port > 0 ? port : null; |
| 2835 | } catch { |
| 2836 | return null; |
| 2837 | } |
| 2838 | }; |
| 2839 | |
| 2840 | const servicePortOption = () => |
| 2841 | Options.integer("port") |
no outgoing calls
no test coverage detected