diff options
Diffstat (limited to 'node_modules/multimatch')
-rw-r--r-- | node_modules/multimatch/index.js | 27 | ||||
-rw-r--r-- | node_modules/multimatch/license | 21 | ||||
-rw-r--r-- | node_modules/multimatch/package.json | 50 | ||||
-rw-r--r-- | node_modules/multimatch/readme.md | 62 |
4 files changed, 160 insertions, 0 deletions
diff --git a/node_modules/multimatch/index.js b/node_modules/multimatch/index.js new file mode 100644 index 000000000..6adc6785d --- /dev/null +++ b/node_modules/multimatch/index.js @@ -0,0 +1,27 @@ +'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) { + var process = arrayUnion; + + if (pattern[0] === '!') { + pattern = pattern.slice(1); + process = arrayDiffer; + } + + return process(ret, minimatch.match(list, pattern, options)); + }, []); +}; diff --git a/node_modules/multimatch/license b/node_modules/multimatch/license new file mode 100644 index 000000000..5ec444d53 --- /dev/null +++ b/node_modules/multimatch/license @@ -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. diff --git a/node_modules/multimatch/package.json b/node_modules/multimatch/package.json new file mode 100644 index 000000000..4fb389f3d --- /dev/null +++ b/node_modules/multimatch/package.json @@ -0,0 +1,50 @@ +{ + "name": "multimatch", + "version": "2.1.0", + "description": "Extends minimatch.match() with support for multiple patterns", + "license": "MIT", + "repository": "sindresorhus/multimatch", + "author": { + "email": "sindresorhus@gmail.com", + "name": "Sindre Sorhus", + "url": "http://sindresorhus.com" + }, + "maintainers": [ + { + "name": "Jon Schlinkert", + "url": "https://github.com/jonschlinkert" + } + ], + "engines": { + "node": ">=0.10.0" + }, + "scripts": { + "test": "mocha" + }, + "files": [ + "index.js" + ], + "keywords": [ + "expand", + "find", + "glob", + "globbing", + "globs", + "match", + "matcher", + "minimatch", + "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": "*" + } +} diff --git a/node_modules/multimatch/readme.md b/node_modules/multimatch/readme.md new file mode 100644 index 000000000..f10fa5dd7 --- /dev/null +++ b/node_modules/multimatch/readme.md @@ -0,0 +1,62 @@ +# multimatch [](https://travis-ci.org/sindresorhus/multimatch) + +> Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns + + +## Install + +```sh + +$ npm install --save multimatch +``` + + +## Usage + +```js +var multimatch = require('multimatch'); + +multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']); +//=> ['unicorn', 'rainbows'] +``` + +See the [tests](https://github.com/sindresorhus/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 an array. + +```js +var results = multimatch(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) |