code: function setURLParameter(url, key, value) {
    if(typeof url !== 'string') {
      throw new Error('URLs must be a string');
    }
  
    if(urlUtils) {
      //node.js
      url = urlUtils.parse(url);
  
      url.search = ((url.search) ? url.search + '&' : '?') + key + '=' + value;
  
      url = urlUtils.format(url);
    }
    else {
      //browser
      url = url.split('?');
  
      url[1] = ((url[1]) ? url[1] + '&' : '') + key + '=' + value;
  
      url = url.join('?');
    }
  
    return url;
  }
docs: Adds a query param to a URL.