From d36277c5187f4c569d5009d0c1226f9664b73c7c Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Tue, 14 May 2019 12:10:40 +1000 Subject: [PATCH] Made logic in filtering reducers a bit more concise. --- src/cli/utils.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cli/utils.ts b/src/cli/utils.ts index 44ca4f3..5a6674d 100644 --- a/src/cli/utils.ts +++ b/src/cli/utils.ts @@ -321,8 +321,7 @@ const onlyMatches = (paths: string[], matches: string[] = []) => { return paths.filter(filePath => { return matches.reduce((result, str) => { const pattern = new RegExp(str, 'gi'); - if (result || pattern.test(filePath)) result = true; - return result; + return result || pattern.test(filePath); }, false); }); }; @@ -331,8 +330,7 @@ const filterMatches = (paths: string[]) => { return paths.filter(filePath => { return !ConfigManager.exclude.reduce((result, match) => { const pattern = new RegExp(match, 'gi'); - if (result || pattern.test(filePath)) result = true; - return result; + return result || pattern.test(filePath); }, false); }); };