debt-collector
Version:
a nodejs tool to identify, track and mesure technical debt
8 lines (7 loc) • 399 B
JavaScript
import { minimatch } from 'minimatch';
export const filterIgnoredFiles = (files, excludePatterns = [], includePatterns = []) => files.filter((file) => {
const matchGlob = (glob) => minimatch(file, glob.replace(/^\.\//, ''));
const isFileIncluded = includePatterns.some(matchGlob);
const isFileExcluded = excludePatterns.some(matchGlob);
return isFileIncluded && !isFileExcluded;
});