Skip to content

Commit

Permalink
Merge pull request #118 from wmertens/patch-1
Browse files Browse the repository at this point in the history
skip: only provide on initial recurse
  • Loading branch information
yuanchuan authored Jan 21, 2022
2 parents 0c8a3e6 + 728ccbb commit 6da8a8b
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions lib/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@ function assertEncoding(encoding) {
}

function guard(fn) {
return function(arg, action) {
if (is.func(fn)) {
var ret = fn(arg, SKIP_FLAG);
if (ret && ret !== SKIP_FLAG) action();
if (is.func(fn))
return function(arg, action) {
if (fn(arg, false)) action();
}
else if (is.regExp(fn)) {
if (is.regExp(fn))
return function(arg, action) {
if (fn.test(arg)) action();
}
else {
return function(arg, action) {
action();
}
}
}

Expand Down

0 comments on commit 6da8a8b

Please sign in to comment.