UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

21 lines (19 loc) 427 B
function transformGitToSSH(link) { if (link === void 0) { link = ''; } if (!link.startsWith('http')) { return link; } var reg = /https:\/\/([^/]+)\/(.*)$/; var match = link.match(reg); if (!match) { return ''; } var result = "git@".concat(match[1], ":").concat(match[2]); if (result.endsWith('.git')) { return result; } return "".concat(result, ".git"); } export { transformGitToSSH };