-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,42 @@ | ||
anymatch | ||
====== | ||
Javascript module to match a string against a regular expression, glob, string, | ||
or function that takes the string as an argument and returns a truthy or falsy | ||
value. The matcher can also be an array of any or all of these. Useful for | ||
allowing a very flexible user-defined config to define things like file paths. | ||
|
||
wip | ||
Usage | ||
----- | ||
`npm install anymatch --save` | ||
|
||
```js | ||
var anymatch = require('anymatch'); | ||
|
||
var matchers = [ | ||
'path/to/file.js', | ||
'path/anyjs/**/*.js', | ||
/foo.js$/, | ||
function (string) { | ||
return string.indexOf('bar') !== -1 && string.length > 10 | ||
} | ||
]; | ||
|
||
anymatch(matchers, 'path/to/file.js'); // true | ||
anymatch(matchers, 'path/anyjs/baz.js'); // true | ||
anymatch(matchers, 'path/to/foo.js'); // true | ||
anymatch(matchers, 'path/to/bar.js'); // true | ||
anymatch(matchers, 'bar.js'); // false | ||
``` | ||
|
||
You can also use the `checker` method to get a function that has already been | ||
bound to your matchers. | ||
|
||
```js | ||
var checker = anymatch.checker(matchers); | ||
|
||
checker('path/to/file.js'); // true | ||
``` | ||
|
||
License | ||
------- | ||
[MIT](https://raw.github.com/es128/anymatch/master/LICENSE) |