function getProxyForUrl(url, options) {
    url = url || ''
    const defaultOptions = {
        mode: 'strict',
        lowerCaseOnly: false,
        favourUpperCase: false,
        excludeNpm: false,
    }
    options = Object.assign({}, defaultOptions, options)

    if (modeOverride === 'legacy' || modeOverride === 'strict') {
        options.mode = modeOverride
    }

    if (options.mode === 'legacy') {
        return legacyGetProxyForUrl(url, options.env || process.env)
    }
   
    const parsedUrl = typeof url === 'string' ? parseUrl(url) : url || {}
    let proto = parsedUrl.protocol
    let hostname = parsedUrl.host
    let port = parsedUrl.port
    if (typeof hostname !== 'string' || !hostname || typeof proto !== 'string') {
        return ''  // Don't proxy URLs without a valid scheme or host.
    }

    proto = proto.split(':', 1)[0]
    // Stripping ports in this way instead of using parsedUrl.hostname to make
    // sure that the brackets around IPv6 addresses are kept.
    hostname = hostname.replace(/:\d*$/, '')
    port = parseInt(port) || DEFAULT_PORTS[proto] || 0
    if (!shouldProxy(hostname, port, options)) {
        return ''  // Don't proxy URLs that match NO_PROXY.
    }

    let proxy =
        getEnv('npm_config_' + proto + '_proxy', options) ||
        getEnv(proto + '_proxy', options) ||
        getEnv('npm_config_proxy', options) ||
        getEnv('all_proxy', options)
    if (proxy && proxy.indexOf('://') === -1) {
        // Missing scheme in proxy, default to the requested URL's scheme.
        proxy = proto + '://' + proxy
    }
    return proxy
}
Get the proxy URL for a given URL.
@param {string|URL} url - The URL, or the result from url.parse.
@param {ProxyOptions} [options] - The options object (optional)
@return {string} The URL of the proxy that should handle the request to the
 given URL. If no proxy is set, this will be an empty string.