File tree Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Expand file tree Collapse file tree 1 file changed +8
-13
lines changed Original file line number Diff line number Diff line change @@ -5,25 +5,20 @@ import { ExtractAction, ExtractedLayers } from "../../extractor/types";
55import { streamToString } from "../../stream-utils" ;
66import { ManifestFile } from "../../types" ;
77
8+ /**
9+ * Return false if any exclusion pattern matches,
10+ * return true if any inclusion pattern matches
11+ */
812function generatePathMatcher (
913 globsInclude : string [ ] ,
1014 globsExclude : string [ ] ,
1115) : ( filePath : string ) => boolean {
1216 return ( filePath : string ) : boolean => {
13- let exclude = false ;
14- for ( const g of globsExclude ) {
15- if ( ! exclude && minimatch ( filePath , g ) ) {
16- exclude = true ;
17- }
18- }
19- if ( ! exclude ) {
20- for ( const g of globsInclude ) {
21- if ( minimatch ( filePath , g ) ) {
22- return true ;
23- }
24- }
17+ if ( globsExclude . some ( glob => minimatch ( filePath , glob ) ) ) {
18+ return false ;
2519 }
26- return false ;
20+
21+ return globsInclude . some ( glob => minimatch ( filePath , glob ) ) ;
2722 } ;
2823}
2924
You can’t perform that action at this time.
0 commit comments