(remoteUrl: string)
| 134 | } |
| 135 | |
| 136 | function parseRemoteHost(remoteUrl: string): string | null { |
| 137 | const trimmed = remoteUrl.trim(); |
| 138 | if (trimmed.length === 0) { |
| 139 | return null; |
| 140 | } |
| 141 | |
| 142 | if (trimmed.startsWith("git@")) { |
| 143 | const hostWithPath = trimmed.slice("git@".length); |
| 144 | const separatorIndex = hostWithPath.search(/[:/]/); |
| 145 | if (separatorIndex <= 0) { |
| 146 | return null; |
| 147 | } |
| 148 | return hostWithPath.slice(0, separatorIndex).toLowerCase(); |
| 149 | } |
| 150 | |
| 151 | try { |
| 152 | return new URL(trimmed).host.toLowerCase(); |
| 153 | } catch { |
| 154 | return null; |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | function parseHostName(host: string): string { |
| 159 | try { |
no outgoing calls
no test coverage detected