* make url protocol right for URL parse * @param {string} gitUrl git url * @returns {string} fixed url
(gitUrl)
| 199 | * @returns {string} fixed url |
| 200 | */ |
| 201 | function correctProtocol(gitUrl) { |
| 202 | // eg: github:foo/bar#v1.0. Should not add double slash, in case of error parsed `pathname` |
| 203 | if (RE_GIT_URL_SHORT.test(gitUrl)) { |
| 204 | return gitUrl; |
| 205 | } |
| 206 | |
| 207 | // eg: user@github.com:foo/bar |
| 208 | if (!RE_CUSTOM_PROTOCOL.test(gitUrl)) { |
| 209 | return `${DEF_GIT_PROTOCOL}${gitUrl}`; |
| 210 | } |
| 211 | |
| 212 | return gitUrl; |
| 213 | } |
| 214 | |
| 215 | /** |
| 216 | * extract git dep version from hash |
no test coverage detected