(url: string)
| 183 | } |
| 184 | |
| 185 | function normalizeGitUrl(url: string): string { |
| 186 | url = url |
| 187 | .replace(/^git\+/, '') |
| 188 | .replace(/\.git$/, '') |
| 189 | .replace(/(^|\/)[^/]+?@/, '$1') // remove "user@" from "ssh://user@host.com:..." |
| 190 | .replace(/(\.[^.]+?):/, '$1/') // change ".com:" to ".com/" from "ssh://user@host.com:..." |
| 191 | .replace(/^git:\/\//, 'https://') |
| 192 | .replace(/^ssh:\/\//, 'https://') |
| 193 | if (url.startsWith('github:')) { |
| 194 | return `https://github.com/${url.slice(7)}` |
| 195 | } else if (url.startsWith('gitlab:')) { |
| 196 | return `https://gitlab.com/${url.slice(7)}` |
| 197 | } else if (url.startsWith('bitbucket:')) { |
| 198 | return `https://bitbucket.org/${url.slice(10)}` |
| 199 | } else if (!url.includes(':') && url.split('/').length === 2) { |
| 200 | return `https://github.com/${url}` |
| 201 | } else { |
| 202 | return url.includes('://') ? url : `https://${url}` |
| 203 | } |
| 204 | } |
no outgoing calls
no test coverage detected