1414npm install anymatchx
1515```
1616
17- #### anymatch (matchers, testString, [ returnIndex] )
17+ #### anymatch(matchers, testString, [ returnIndex] )
1818* __ matchers__ : (_ Array|String|RegExp|Function_ )
1919String to be directly matched, string with glob patterns, regular expression
2020test, function that takes the testString as an argument and returns a truthy
@@ -25,15 +25,13 @@ the first matcher that that testString matched, or -1 if no match, instead of a
2525boolean result.
2626
2727``` js
28- var anymatch = require (' anymatch' );
28+ const anymatch = require (' anymatch' );
2929
30- var matchers = [
30+ const matchers = [
3131 ' path/to/file.js' ,
3232 ' path/anyjs/**/*.js' ,
3333 / foo\. js$ / ,
34- function (string ) {
35- return string .indexOf (' bar' ) !== - 1 && string .length > 10
36- }
34+ (string ) => string .includes (' bar' ) && string .length > 10
3735];
3836
3937anymatch (matchers, ' path/to/file.js' ); // true
@@ -48,8 +46,6 @@ anymatch(matchers, 'path/anyjs/foo.js', true); // 1
4846
4947// skip matchers
5048anymatch (matchers, ' path/to/file.js' , false , 1 ); // false
51- anymatch (matchers, ' path/anyjs/foo.js' , true , 2 , 3 ); // 2
52- anymatch (matchers, ' path/to/bar.js' , true , 0 , 3 ); // -1
5349
5450// using globs to match directories and their children
5551anymatch (' node_modules' , ' node_modules' ); // true
@@ -59,7 +55,7 @@ anymatch('node_modules/**', '/absolute/path/to/node_modules/somelib/index.js');
5955anymatch (' **/node_modules/**' , ' /absolute/path/to/node_modules/somelib/index.js' ); // true
6056```
6157
62- #### anymatch (matchers)
58+ #### anymatch(matchers)
6359You can also pass in only your matcher(s) to get a curried function that has
6460already been bound to the provided matching criteria. This can be used as an
6561` Array#filter ` callback.
0 commit comments