Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function shouldCompile(filename, exts, matcher, ignoreNodeModules) {
if (typeof filename !== 'string') {
return false;
}
if (exts.indexOf(path.extname(filename)) === -1) {
return false;
}
const resolvedFilename = path.resolve(filename);
if (ignoreNodeModules && nodeModulesRegex.test(resolvedFilename)) {
return false;
}
if (matcher && typeof matcher === 'function') {
return !!matcher(resolvedFilename);
}
return true;
}