docs: function getProxyUri(uri) {
  
  	if (uri.protocol === 'https:' && env.httpsProxy || uri.protocol === 'http:' && env.httpProxy) {
  
  		if (env.noProxy) {
  			var canonicalHost = uri.host.replace(/^\.*/, '.');
  			var port = uri.port || (uri.protocol === 'https:' ? '443' : '80');
  
  			var patterns = env.noProxy.split(',');
  			for (var i = patterns.length - 1; i >= 0; i--) {
  				var pattern = patterns[i].trim().toLowerCase();
  
  				// don't use a proxy at all
  				if (pattern === '*') {
  					return null;
  				}
  
  				// Remove leading * and make sure to have exact one leading dot (.)
  				pattern = pattern.replace(/^[\*]+/, '').replace(/^\.*/, '.');
  
  				// add port if no specified
  				if (pattern.indexOf(':') === -1) {
  					pattern += ':' + port;
  				}
  
  				// if host ends with pattern, no proxy should be used
  				if (canonicalHost.indexOf(pattern) === canonicalHost.length - pattern.length) {
  					return null;
  				}
  			}
  		}
  
  		if (uri.protocol === 'https:' && env.httpsProxy) {
  			return env.httpsProxy;
  		} else if (uri.protocol === 'http:' && env.httpProxy) {
  			return env.httpProxy;
  		}
  	}
  
  	return null;
  }