MCPcopy
hub / github.com/di-sukharev/opencommit / shouldProxy

Function shouldProxy

out/cli.cjs:24941–24967  ·  view source on GitHub ↗
(hostname, port)

Source from the content-addressed store, hash-verified

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) {
24944 return true;
24945 }
24946 if (NO_PROXY2 === "*") {
24947 return false;
24948 }
24949 return NO_PROXY2.split(/[,\s]/).every(function(proxy) {
24950 if (!proxy) {
24951 return true;
24952 }
24953 var parsedProxy = proxy.match(/^(.+):(\d+)$/);
24954 var parsedProxyHostname = parsedProxy ? parsedProxy[1] : proxy;
24955 var parsedProxyPort = parsedProxy ? parseInt(parsedProxy[2]) : 0;
24956 if (parsedProxyPort && parsedProxyPort !== port) {
24957 return true;
24958 }
24959 if (!/^[.*]/.test(parsedProxyHostname)) {
24960 return hostname !== parsedProxyHostname;
24961 }
24962 if (parsedProxyHostname.charAt(0) === "*") {
24963 parsedProxyHostname = parsedProxyHostname.slice(1);
24964 }
24965 return !stringEndsWith.call(hostname, parsedProxyHostname);
24966 });
24967 }
24968 function getEnv2(key) {
24969 return process.env[key.toLowerCase()] || process.env[key.toUpperCase()] || "";
24970 }

Callers 1

getProxyForUrlFunction · 0.85

Calls 5

getEnv2Function · 0.85
toLowerCaseMethod · 0.80
testMethod · 0.80
matchMethod · 0.45
sliceMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…