( host: string | undefined, port: string | undefined, path: string | undefined, )
| 20 | } |
| 21 | |
| 22 | function joinRemoteParts( |
| 23 | host: string | undefined, |
| 24 | port: string | undefined, |
| 25 | path: string | undefined, |
| 26 | ): string { |
| 27 | const normalizedHost = host?.trim() ?? ''; |
| 28 | const normalizedPort = port?.trim() ?? ''; |
| 29 | const normalizedPath = stripGitSuffix(path ?? ''); |
| 30 | const parts = [normalizedHost]; |
| 31 | if (normalizedPort.length > 0) parts.push(normalizedPort); |
| 32 | if (normalizedPath.length > 0) parts.push(normalizedPath); |
| 33 | return parts.join('/'); |
| 34 | } |
| 35 | |
| 36 | function stripGitSuffix(value: string): string { |
| 37 | let normalized = value.trim().replace(/^\/+/, '').replace(/\/+$/, ''); |
no test coverage detected