(url2)
| 24919 | return s2.length <= this.length && this.indexOf(s2, this.length - s2.length) !== -1; |
| 24920 | }; |
| 24921 | function getProxyForUrl(url2) { |
| 24922 | var parsedUrl = typeof url2 === "string" ? parseUrl(url2) : url2 || {}; |
| 24923 | var proto2 = parsedUrl.protocol; |
| 24924 | var hostname = parsedUrl.host; |
| 24925 | var port = parsedUrl.port; |
| 24926 | if (typeof hostname !== "string" || !hostname || typeof proto2 !== "string") { |
| 24927 | return ""; |
| 24928 | } |
| 24929 | proto2 = proto2.split(":", 1)[0]; |
| 24930 | hostname = hostname.replace(/:\d*$/, ""); |
| 24931 | port = parseInt(port) || DEFAULT_PORTS[proto2] || 0; |
| 24932 | if (!shouldProxy(hostname, port)) { |
| 24933 | return ""; |
| 24934 | } |
| 24935 | var proxy = getEnv2("npm_config_" + proto2 + "_proxy") || getEnv2(proto2 + "_proxy") || getEnv2("npm_config_proxy") || getEnv2("all_proxy"); |
| 24936 | if (proxy && proxy.indexOf("://") === -1) { |
| 24937 | proxy = proto2 + "://" + proxy; |
| 24938 | } |
| 24939 | return proxy; |
| 24940 | } |
| 24941 | function shouldProxy(hostname, port) { |
| 24942 | var NO_PROXY2 = (getEnv2("npm_config_no_proxy") || getEnv2("no_proxy")).toLowerCase(); |
| 24943 | if (!NO_PROXY2) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…