function addScheme(hostOrURL) {
  if (hostOrURL.match(/^http/)) {
    return hostOrURL;
  } else if (hostOrURL.match(/^localhost(:\d+)?$/)) {
    return "http://" + hostOrURL;
  } else {
    return "https://" + hostOrURL;
  }
}
// appropriate. (localhost gets http; anything else is always https.)
appropriate. (localhost gets http; anything else is always https.)
appropriate . ( localhost gets http ; anything else is always https . )
function addScheme(hostOrURL) {
  if (hostOrURL.match(/^http/)) {
    return hostOrURL;
  } else if (hostOrURL.match(/^localhost(:\d+)?$/)) {
    return "http://" + hostOrURL;
  } else {
    return "https://" + hostOrURL;
  }
}
function addScheme ( hostOrURL ) { if ( hostOrURL . match ( / ^http / ) ) { return hostOrURL ; } else if ( hostOrURL . match ( / ^localhost(:\d+)?$ / ) ) { return "http://" + hostOrURL ; } else { return "https://" + hostOrURL ; } }
appropriate.
appropriate .