thecodrr / fdir

⚡ The fastest directory crawler & globbing library for NodeJS. Crawls 1m files in < 1s
https://thecodrr.github.io/fdir/
MIT License
1.51k stars 58 forks source link

feat: add support for multiple filters #26

Closed thecodrr closed 4 years ago

thecodrr commented 4 years ago

It is now possible to add multiple filters like:

new fdir().filter(p => p.endsWith(".js")).filter(p => p.startsWith(".nim"))

Obviously, you can also do that in a single filter but I think it allows for better readability. The performance hit is also negligible.

kwaping commented 4 years ago

It looks like you decided to implement this as an OR join on the filters. I was trying to use multiple filters in an AND fashion, so that each successive .filter() would further refine the list.

Would it be possible to change the implementation, or add this type of AND filtering?