/**
 * 强制Url转https协议
 * @param url
 * @returns
 */
function toHttps(url) {
  if (!url) return '';
  var newUrl = url.replace(/^(http:\/\/|:\/\/|\/\/|\/)/, 'https://');

  if (/^https:\/\//.test(newUrl)) {
    return newUrl;
  }

  return url;
}

export default toHttps;
