Initial commit
This commit is contained in:
39
node_modules/maximatch/index.js
generated
vendored
Normal file
39
node_modules/maximatch/index.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
'use strict';
|
||||
var minimatch = require('minimatch');
|
||||
var arrayUnion = require('array-union');
|
||||
var arrayDiffer = require('array-differ');
|
||||
var arrify = require('arrify');
|
||||
|
||||
module.exports = function (list, patterns, options) {
|
||||
list = arrify(list);
|
||||
patterns = arrify(patterns);
|
||||
|
||||
if (list.length === 0 || patterns.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
options = options || {};
|
||||
|
||||
return patterns.reduce(function (ret, pattern) {
|
||||
if (typeof pattern === 'function') {
|
||||
|
||||
return arrayUnion(ret, list.filter(pattern));
|
||||
|
||||
} else if (pattern instanceof RegExp) {
|
||||
|
||||
return arrayUnion(ret, list.filter(function(item) {
|
||||
return pattern.test(item);
|
||||
}));
|
||||
|
||||
} else {
|
||||
var process = arrayUnion;
|
||||
|
||||
if (pattern[0] === '!') {
|
||||
pattern = pattern.slice(1);
|
||||
process = arrayDiffer;
|
||||
}
|
||||
|
||||
return process(ret, minimatch.match(list, pattern, options));
|
||||
}
|
||||
}, []);
|
||||
};
|
21
node_modules/maximatch/license
generated
vendored
Normal file
21
node_modules/maximatch/license
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Sindre Sorhus, Jon Schlinkert, contributors.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
44
node_modules/maximatch/package.json
generated
vendored
Normal file
44
node_modules/maximatch/package.json
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "maximatch",
|
||||
"version": "0.1.0",
|
||||
"description": "Extends multimatch() with support for filter functions and regular expressions",
|
||||
"license": "MIT",
|
||||
"repository": "timkendrick/maximatch",
|
||||
"author": {
|
||||
"email": "timkendrick@gmail.com",
|
||||
"name": "Tim Kendrick"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"keywords": [
|
||||
"expand",
|
||||
"find",
|
||||
"glob",
|
||||
"globbing",
|
||||
"globs",
|
||||
"match",
|
||||
"matcher",
|
||||
"minimatch",
|
||||
"multimatch",
|
||||
"pattern",
|
||||
"patterns",
|
||||
"wildcard"
|
||||
],
|
||||
"dependencies": {
|
||||
"array-differ": "^1.0.0",
|
||||
"array-union": "^1.0.1",
|
||||
"arrify": "^1.0.0",
|
||||
"minimatch": "^3.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.4.1",
|
||||
"mocha": "*"
|
||||
}
|
||||
}
|
71
node_modules/maximatch/readme.md
generated
vendored
Normal file
71
node_modules/maximatch/readme.md
generated
vendored
Normal file
@@ -0,0 +1,71 @@
|
||||
# maximatch [](https://travis-ci.org/timkendrick/maximatch)
|
||||
|
||||
> Extends [`multimatch()`](https://github.com/sindresorhus/multimatch) with support for filter functions and regular expressions
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
|
||||
$ npm install --save maximatch
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
var maximatch = require('maximatch');
|
||||
|
||||
maximatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);
|
||||
//=> ['unicorn', 'rainbows']
|
||||
|
||||
maximatch(['unicorn', 'cake', 'rainbows'], function(path) { return path.length > 4; });
|
||||
//=> ['unicorn', 'rainbows']
|
||||
|
||||
maximatch(['unicorn', 'cake', 'rainbows'], /^[^k]+$/);
|
||||
//=> ['unicorn', 'rainbows']
|
||||
|
||||
maximatch(['unicorn', 'cake', 'rainbows'], [function(path) { return path.charAt(0) === 'u'; }, /w/]);
|
||||
//=> ['unicorn', 'rainbows']
|
||||
```
|
||||
|
||||
See the [tests](https://github.com/timkendrick/multimatch/blob/master/test.js) for more usage examples and expected matches.
|
||||
|
||||
|
||||
## API
|
||||
|
||||
Same as [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) except for `pattern` also accepting a filter function, a regular expression, or an array that can contain globs, filter functions and regular expressions.
|
||||
|
||||
```js
|
||||
var results = maximatch(paths, patterns);
|
||||
```
|
||||
|
||||
The return value is an array of matching paths.
|
||||
|
||||
|
||||
## How multiple patterns work
|
||||
|
||||
Positive patterns (e.g. `foo` or `*`) add to the results, while negative patterns (e.g. `!foo`) subtract from the results.
|
||||
|
||||
Therefore a lone negation (e.g. `['!foo']`) will never match anything – use `['*', '!foo']` instead.
|
||||
|
||||
|
||||
## Globbing patterns
|
||||
|
||||
Just a quick overview.
|
||||
|
||||
- `*` matches any number of characters, but not `/`
|
||||
- `?` matches a single character, but not `/`
|
||||
- `**` matches any number of characters, including `/`, as long as it's the only thing in a path part
|
||||
- `{}` allows for a comma-separated list of "or" expressions
|
||||
- `!` at the beginning of a pattern will negate the match
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
See [globby](https://github.com/sindresorhus/globby) if you need to match against the filesystem instead of a list.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com), [Jon Schlinkert](https://github.com/jonschlinkert), [Tim Kendrick](https://github.com/timkendrick)
|
Reference in New Issue
Block a user