File tree Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Expand file tree Collapse file tree 1 file changed +18
-6
lines changed Original file line number Diff line number Diff line change @@ -206,17 +206,29 @@ func FilterOutPrefixes(rejectedPrefixes ...string) ReadDirFilter {
206
206
}
207
207
}
208
208
209
- // OrFilter creates a ReadDirFilter that accepts all items that are accepted by x or by y
210
- func OrFilter (x , y ReadDirFilter ) ReadDirFilter {
209
+ // OrFilter creates a ReadDirFilter that accepts all items that are accepted
210
+ // by any (at least one) of the given filters
211
+ func OrFilter (filters ... ReadDirFilter ) ReadDirFilter {
211
212
return func (path * Path ) bool {
212
- return x (path ) || y (path )
213
+ for _ , f := range filters {
214
+ if f (path ) {
215
+ return true
216
+ }
217
+ }
218
+ return false
213
219
}
214
220
}
215
221
216
- // AndFilter creates a ReadDirFilter that accepts all items that are accepted by both x and y
217
- func AndFilter (x , y ReadDirFilter ) ReadDirFilter {
222
+ // AndFilter creates a ReadDirFilter that accepts all items that are accepted
223
+ // by all the given filters
224
+ func AndFilter (filters ... ReadDirFilter ) ReadDirFilter {
218
225
return func (path * Path ) bool {
219
- return x (path ) && y (path )
226
+ for _ , f := range filters {
227
+ if ! f (path ) {
228
+ return false
229
+ }
230
+ }
231
+ return true
220
232
}
221
233
}
222
234
You can’t perform that action at this time.
0 commit comments