Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return domain_white_list.some(rule => {
// Check whether we've got '*' as a wild character symbol
if (rule.includes('*')) {
return matcher.isMatch(domain, rule);
}
// If domain is an absolute path such as `http://...`
// We can directly check whether it directly equals to `domain`
// And we don't need to cope with `endWith`.
return domain === rule || hostname.endsWith(rule);
});
};
webhooks.forEach(webhook => {
if (webhook.isDisabled === true) {
logger.log.debug(`Skipping a [${webhook.relativePath}] webhook because it's disabled`);
return;
}
// checking is webhook matches a target resource
const opts = {
caseSensitive: os.platform() !== 'win32'
};
if (matcher.isMatch(target.relativePath, webhook.relativePath, opts)) {
postWebhook(webhook, target);
} else {
logger.log.debug(`The [${webhook.relativePath}] webhook doesn't match to [${target.relativePath}] resource`);
}
});
return Promise.resolve();
return files.filter(f => {
if (f == null)
return false;
if (ignoreHidden && /^\./.test(f))
return false;
for (let p of ignorePatterns) {
if (matcher.isMatch(f, p))
return false;
}
return true;
});
}
const rules = noProxy.split(/[,\s]/);
for (const rule of rules) {
const ruleMatch = rule
.replace(/^(?\.)/, '*')
.match(/^(?.+?)(?::(?\d+))?$/);
if (!ruleMatch || !ruleMatch.groups) {
throw new UnexpectedStateError('Invalid NO_PROXY pattern.');
}
if (!ruleMatch.groups.hostname) {
throw new UnexpectedStateError('NO_PROXY entry pattern must include hostname. Use * to match any hostname.');
}
const hostnameIsMatch = matcher.isMatch(subjectUrlTokens.hostname, ruleMatch.groups.hostname);
if (hostnameIsMatch && (!ruleMatch.groups || !ruleMatch.groups.port || subjectUrlTokens.port && subjectUrlTokens.port === ruleMatch.groups.port)) {
return true;
}
}
return false;
};
.map(h => ({
host: h,
strict: matcher.isMatch(host, h),
wildcard: matcher.isMatch(host, `*.${h}`)
}))
.map(h => ({
host: h,
isStrictMatch: matcher.isMatch(str, h),
isWildcardMatch: matcher.isMatch(str, `*.${h}`)
}))
.map(h => ({
host: h,
isStrictMatch: matcher.isMatch(str, h),
isWildcardMatch: matcher.isMatch(str, `*.${h}`)
}))
d => (isDisposable = isDisposable || isMatch(email, `*.${d}`))
);