Skip to content

Commit 5d862c7

Browse files
committed
Use micromatch.matcher on strings only
Its behavior with functions is different (more generic) which broke expected behavior for some scenarios. This patch fixes the failing tests that were just introduced.
1 parent 31fa47f commit 5d862c7

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
77
criteria = arrify(criteria);
88
value = arrify(value);
99
if (arguments.length === 1) {
10-
return criteria.length === 1 ?
11-
micromatch.matcher(criteria[0]) :
12-
anymatch.bind(null, criteria.map(function(criterion) {
13-
return micromatch.matcher(criterion);
14-
}));
10+
return anymatch.bind(null, criteria.map(function(criterion) {
11+
return typeof criterion === 'string' ?
12+
micromatch.matcher(criterion) : criterion;
13+
}));
1514
}
1615
startIndex = startIndex || 0;
1716
var string = value[0];

0 commit comments

Comments
 (0)