Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
if (exclude.some(item => nanomatch.isMatch(file.filePath, item))) {
// Excluded
return route.whitelist.find(mask => {
if (_.isString(mask))
return nanomatch.isMatch(action, mask, { unixify: false, });
else if (_.isRegExp(mask))
return mask.test(action);
}) != null;
},
module.exports = function(file, pattern) {
return nanomatch.isMatch(file, pattern);
};
public isMetaFile (filePath: string, absolute: boolean = false): boolean {
if (this._metaFilesCache.has(filePath)) {
return this._metaFilesCache.get(filePath)!
}
const isMatch = nanomatch.isMatch(
filePath,
absolute ? this._metaFileAbsolutePatterns : this._metaFilePatterns,
)
this._metaFilesCache.set(filePath, isMatch)
return isMatch
}
export const isWhitelisted = (whitelist: string[], ip: string): boolean => {
if (Array.isArray(whitelist)) {
for (const item of whitelist) {
if (nm.isMatch(ip, item)) {
return true;
}
}
}
return false;
};
public isReloadServerFile (filePath: string, absolute: boolean = false): boolean {
if (this._readServerFilesCache.has(filePath)) {
return this._readServerFilesCache.get(filePath)!
}
const isMatch = nanomatch.isMatch(
filePath,
absolute ? this._reloadServerAbsolutePatterns : this._reloadServerPatterns,
)
this._readServerFilesCache.set(filePath, isMatch)
return isMatch
}
}
export const isWhitelisted = (whitelist: string[], remoteAddress: string): boolean => {
if (!Array.isArray(whitelist) || !whitelist.length) {
return true;
}
if (Array.isArray(whitelist)) {
for (const ip of whitelist) {
try {
if (nm.isMatch(remoteAddress, ip)) {
return true;
}
} catch {
return false;
}
}
}
return false;
};