Skip to content

Commit

Permalink
Use micromatch.matcher on strings only
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
es128 committed Mar 27, 2015
1 parent 31fa47f commit 5d862c7
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ var anymatch = function(criteria, value, returnIndex, startIndex, endIndex) {
criteria = arrify(criteria);
value = arrify(value);
if (arguments.length === 1) {
return criteria.length === 1 ?
micromatch.matcher(criteria[0]) :
anymatch.bind(null, criteria.map(function(criterion) {
return micromatch.matcher(criterion);
}));
return anymatch.bind(null, criteria.map(function(criterion) {
return typeof criterion === 'string' ?
micromatch.matcher(criterion) : criterion;
}));
}
startIndex = startIndex || 0;
var string = value[0];
Expand Down

0 comments on commit 5d862c7

Please sign in to comment.