-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter option doesn't work the same way in copy and copySync #180
Comments
Thanks for pointing this out :) |
I've been experiencing the same problem and I think I may have found what is going on. In copy-sync, the check for filter that sets performCopy is only checked inside the stats.isFile() conditional. I moved the setting of performCopy outside the conditional then wrapped the whole conditional (isFile, isDirectory, isSymbolicLink) in a performCopy conditional. That worked, but of course I may have broken some other internal code functionality in the process. Here's my code fragment if it's any help: ar performCopy = false if (options.filter instanceof RegExp) performCopy = options.filter.test(src) if (performCopy) { |
@jprichardson Should this added to the v1.0.0 milestone? |
@jprichardson ping? |
Ideally yes, but if it's going to be a lot of work, no. |
OK, should document this though. |
Fixed by #324. |
copySync
applies the filter only to files, whilecopy
applies the filter to every entry.So if you have the following directory structure:
calling
copy
with{ filter: /baz/ }
will produce:wheras
copySync
will do:The former is obviously what's expected.
The text was updated successfully, but these errors were encountered: