function buildURL(url, search = "", query = "") {
  return (
    (/(http(s)?:\/\/.)/.test(url) ? url : "http://" + url) +
    search +
    encodeURI(query)
  );
}
/*
 * Adds protocol if not present, encodes search string
 */
Adds protocol if not present, encodes search string
Adds protocol if not present encodes search string
function buildURL(url, search = "", query = "") {
  return (
    (/(http(s)?:\/\/.)/.test(url) ? url : "http://" + url) +
    search +
    encodeURI(query)
  );
}
function buildURL ( url , search = "" , query = "" ) { return ( ( / (http(s)?:\/\/.) / . test ( url ) ? url : "http://" + url ) + search + encodeURI ( query ) ) ; }
Adds protocol if not present, encodes search string
Adds protocol if not present encodes search string