Skip to content

Commit

Permalink
Made logic in filtering reducers a bit more concise.
Browse files Browse the repository at this point in the history
  • Loading branch information
thekevinbrown committed May 14, 2019
1 parent f69225b commit d36277c
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cli/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ const onlyMatches = (paths: string[], matches: string[] = []) => {
return paths.filter(filePath => {
return matches.reduce<boolean>((result, str) => {
const pattern = new RegExp(str, 'gi');
if (result || pattern.test(filePath)) result = true;
return result;
return result || pattern.test(filePath);
}, false);
});
};
Expand All @@ -331,8 +330,7 @@ const filterMatches = (paths: string[]) => {
return paths.filter(filePath => {
return !ConfigManager.exclude.reduce<boolean>((result, match) => {
const pattern = new RegExp(match, 'gi');
if (result || pattern.test(filePath)) result = true;
return result;
return result || pattern.test(filePath);
}, false);
});
};
Expand Down

0 comments on commit d36277c

Please sign in to comment.