Xttp
@param {*} url
@param {*} params
@param {*} fn
331038
function Xttp(url, params, fn) {
  const request = new Xttp.Request(url, params);
  fn && request.end(fn);
  return request;
}
885818
function addFragmentParam(url, param, value) {
  return url +
      (url.indexOf('#') == -1 ? '#' : '&') +
      encodeURIComponent(param) + '=' + encodeURIComponent(value);
}
22248
function goToUrl(url) {
        if (!url) { return; }

        if (_.isArray(url)) {
            url = url.join('/');
        }

        var hasHttp = url.indexOf('http') === 0;
        if (!hasHttp && url.indexOf('/') !== 0) {
            url = '/' + url;
        }

        hasHttp ? $window.location.href = url : $location.path(url);
    }
710177
function(type, url, data, options, callback) {
  /* Make a request to the given URL, and call:
   *  callback(http_code, headers, data);
   *
   * Arguments:
   *  - options: hash, with the possible members:
   *    - emulate_browser: Add some firefox headers if set to True
   *    - additional_headers: hash containing some headers to add / redefine.
   */
  var body;
  var purl = URL.parse(url);
  var qs = purl.query || '';
  var secure = purl.protocol == 'https:';
  var default_port = secure && 443 || 80;
  var client = http.createClient(purl.port || default_port, purl.hostname, secure);
  client.addListener('error', function(err) {
    console.log('Error in nodetk web client.');
    console.log(err.message);
    console.log(err.stack);
  });
  var headers = {
    'host': purl.hostname,
  };
  extend(headers, options.additional_headers || {});
  if(options.emulate_browser) extend(headers, {
    'User-Agent': 'Mozilla/5.0 (X11; U; Linux i686; fr; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language': 'fr-fr,fr;q=0.8,en;q=0.5,en-us;q=0.3',
    //'Accept-Encoding': 'gzip,deflate',
  });
  if(type == 'POST' || type == 'PUT' || type == "DELETE") {
    body = data && querystring.stringify(data) || "";
    headers['content-type'] = 'application/x-www-form-urlencoded';
    headers['content-length'] = Buffer.byteLength(body);
  }
  else if (data) {
    if(qs) qs += '&';
    qs += querystring.stringify(data);
  }
  var request = client.request(type, purl.pathname +'?'+ qs, headers);
  if(body) {
    request.write(body, 'utf8');
  }
  request.end();
  var data = '';
  request.on('response', function(response) {
    response.setEncoding('utf8');
    response.on('data', function(chunk) {
      data += chunk;
    });
    response.on('end', function() {
      callback(response.statusCode, response.headers, data);
    });
  });
}
862046
function parseUrl(url, callback) {
  var options = {
    uri:            url,
    method:         "GET",
    followRedirect: true
  };

  request(options, function (err, res, body) {
    if (err) {
      callback(err);
    } else {
      callback(null, parse(body));
    }
  });
}
76168
function toDataUrl(url, callback) {
  var xhr = new XMLHttpRequest();
  xhr.onload = function() {
    var reader = new FileReader();
    reader.onloadend = function() {
      callback(reader.result);
    };
    reader.readAsDataURL(xhr.response);
  };
  xhr.open('GET', url);
  xhr.responseType = 'blob';
  xhr.send();
}
540265
function(id, params){
        var file = this._files[id],
            name = this.getName(id),
            size = this.getSize(id);
                
        this._loaded[id] = 0;
                                
        var xhr = this._xhrs[id] = new XMLHttpRequest();
        var self = this;
                                        
        xhr.upload.onprogress = function(e){
            if (e.lengthComputable){
                self._loaded[id] = e.loaded;
                self._options.onProgress(id, name, e.loaded, e.total);
            }
        };

        xhr.onreadystatechange = function(){            
            if (xhr.readyState == 4){
                self._onComplete(id, xhr);                    
            }
        };

        // build query string
        params = params || {};
        params['qqfile'] = name;
        var queryString = qq.obj2url(params, this._options.action);

        xhr.open("POST", queryString, true);
        xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
        xhr.setRequestHeader("X-File-Name", encodeURIComponent(name));
        xhr.setRequestHeader("Content-Type", "application/octet-stream");
        xhr.send(file);
    }
326485
function parseRepoURL(inputUrl) {
  if (!inputUrl) {
    throw new ServerlessError('URL is required');
  }

  const url = URL.parse(inputUrl.replace(/\/$/, ''));

  // check if url parameter is a valid url
  if (!url.host) {
    throw new ServerlessError('The URL you passed is not a valid URL');
  }

  switch (url.hostname) {
    case 'github.com': {
      return parseGitHubURL(url);
    }
    case 'bitbucket.org': {
      return parseBitbucketURL(url);
    }
    case 'gitlab.com': {
      return parseGitlabURL(url);
    }
    default: {
      const msg =
        'The URL you passed is not one of the valid providers: "GitHub", "Bitbucket", or "GitLab".';
      throw new ServerlessError(msg);
    }
  }
}
870705
function(url, params, formatFunction) {

		if (params) {

			// Set default formatting function
			formatFunction = formatFunction || encodeURIComponent;

			// Override the items in the URL which already exist
			for (var x in params) {
				var str = '([\\?\\&])' + x + '=[^\\&]*';
				var reg = new RegExp(str);
				if (url.match(reg)) {
					url = url.replace(reg, '$1' + x + '=' + formatFunction(params[x]));
					delete params[x];
				}
			}
		}

		if (!this.isEmpty(params)) {
			return url + (url.indexOf('?') > -1 ? '&' : '?') + this.param(params, formatFunction);
		}

		return url;
	}
283902
def url_to_fn(url):
    
    url = url.replace("http://", "").replace("https://", "")
    url = url.split("?")[0]

    return url.replace("%", "_").replace("/", "_")
933070
function appendQueryString(url, params){
        var key;
        url = url || '';
        if(params){
            if(url.indexOf('?') === -1){
                url += '?';
            }
            if(typeof params === 'string'){
                url += params;
            } else if (typeof params === 'object'){
                for(key in params){
                    if(!/[?&]$/.test(url)){
                        url += '&';
                    }
                    url += encodeURIComponent(key) + '=' + encodeURIComponent(params[key]);
                }
            }
        }

        return url;
    }
1082233
function urlmon(options) {
    
    this.url = options.url;
    this.interval = options.interval || 5000;
    this.timeout = options.timeout || 3000;
    this.handle = null;
        
}
138182
function cloneTxParams(txParams){
  return {
    from: txParams.from,
    to: txParams.to,
    value: txParams.value,
    data: txParams.data,
    gas: txParams.gas,
    gasPrice: txParams.gasPrice,
    nonce: txParams.nonce,
  }
}
1183230
function addQueryString( url, params ) {
		var queryString = [];

		if ( !params )
			return url;
		else {
			for ( var i in params )
				queryString.push( i + "=" + encodeURIComponent( params[ i ] ) );
		}

		return url + ( ( url.indexOf( "?" ) != -1 ) ? "&" : "?" ) + queryString.join( "&" );
	}
437288
function parseUrlParams(params) {
    let qs = '';
    let i = 0;
    each(params, (val, key) => {
        if (i > 0) {
            qs += '&amp;';
        }
        qs += key + '=' + val;
        i += 1;
    })
    return qs;
}
1128763
function validateParams(fs, param2) {
  var err;

  if(!fs) {
    err = new Errors.EINVAL('No filesystem provided');
  } else if(!param2) {
    err = new Errors.EINVAL('Second argument must be specified');
  }

  return err;
}
136251
function FTPProcess(params) {
        RED.nodes.createNode(this, params);
        this.name = params.name;
        this.waitfor = params.waitfor;
        /* this.host = params.host;
        this.hostType = params.hostType;
        this.port = params.port;
        this.portType = params.portType;
        this.filename = params.filename;
        this.filenameType = params.filenameType;
        this.location = params.location;
        this.locationType = params.locationType;
        this.remoteLocation = params.remoteLocation;
        this.remoteLocationType = params.remoteLocationType;
        this.user= params.user;
        this.userType = params.userType;
        this.password = params.password;
        this.passwordType = params.passwordType;*/
        let node = this;
        this.on('input', function(msg) {
            if (msg.error) {
                // FIXME: Add error handling here
            } else {
                params.actionType = 'read';
                console.log('FTPProcess params .....');
                console.log(JSON.stringify(params));
                processFTPNode(node, params, msg);
            }
        });
    }