'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

function transformGitToSSH() {
  var link = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  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");
}

exports.transformGitToSSH = transformGitToSSH;
