Skip to content
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

Ignore children find if parent was excluded #3

Merged
merged 4 commits into from
Feb 16, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/find.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ find = module.exports.async = (source, options, cb , depth = 0 ) ->
list = []
# Check the current file through filter options
filter.async source, depth, options, (ok) ->
return cb null, list if options.lazy and not ok
list.push source if ok
# check source entry
stat = if options.dereference? then fs.stat else fs.lstat
Expand Down Expand Up @@ -79,8 +80,10 @@ find = module.exports.async = (source, options, cb , depth = 0 ) ->
# If anything out of order happened.
findSync = module.exports.sync = (source, options = {}, depth = 0) ->
list = []
ok = filter.sync source, depth, options
return list if options.lazy and not ok
# Check the current file through filter options
list.push source if filter.sync source, depth, options
list.push source if ok
# check source entry
stat = if options.dereference? then fs.statSync else fs.lstatSync
try
Expand Down