(origin: string)
| 2779 | }); |
| 2780 | |
| 2781 | const portFromOrigin = (origin: string): number | null => { |
| 2782 | try { |
| 2783 | const url = new URL(origin); |
| 2784 | if (!url.port) return url.protocol === "https:" ? 443 : 80; |
| 2785 | const port = Number.parseInt(url.port, 10); |
| 2786 | return Number.isInteger(port) && port > 0 ? port : null; |
| 2787 | } catch { |
| 2788 | return null; |
| 2789 | } |
| 2790 | }; |
| 2791 | |
| 2792 | const servicePortOption = () => |
| 2793 | Options.integer("port") |
no outgoing calls
no test coverage detected