summaryrefslogtreecommitdiff
path: root/src/node_modules/multimatch
diff options
context:
space:
mode:
Diffstat (limited to 'src/node_modules/multimatch')
-rw-r--r--src/node_modules/multimatch/index.d.ts28
-rw-r--r--src/node_modules/multimatch/index.js30
-rw-r--r--src/node_modules/multimatch/license9
-rw-r--r--src/node_modules/multimatch/package.json48
-rw-r--r--src/node_modules/multimatch/readme.md80
5 files changed, 195 insertions, 0 deletions
diff --git a/src/node_modules/multimatch/index.d.ts b/src/node_modules/multimatch/index.d.ts
new file mode 100644
index 0000000..ecddcdc
--- /dev/null
+++ b/src/node_modules/multimatch/index.d.ts
@@ -0,0 +1,28 @@
+import {IOptions} from 'minimatch';
+
+declare namespace multimatch {
+ type Options = Readonly<IOptions>;
+}
+
+/**
+Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns.
+
+@param paths - Paths to match against.
+@param patterns - Globbing patterns to use. For example: `['*', '!cake']`. See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage).
+@returns The matching paths in the order of input paths.
+
+@example
+```
+import multimatch = require('multimatch');
+
+multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);
+//=> ['unicorn', 'rainbows']
+```
+*/
+declare function multimatch(
+ paths: string | readonly string[],
+ patterns: string | readonly string[],
+ options?: multimatch.Options
+): string[];
+
+export = multimatch;
diff --git a/src/node_modules/multimatch/index.js b/src/node_modules/multimatch/index.js
new file mode 100644
index 0000000..a0833b5
--- /dev/null
+++ b/src/node_modules/multimatch/index.js
@@ -0,0 +1,30 @@
+'use strict';
+const minimatch = require('minimatch');
+const arrayUnion = require('array-union');
+const arrayDiffer = require('array-differ');
+const arrify = require('arrify');
+
+module.exports = (list, patterns, options = {}) => {
+ list = arrify(list);
+ patterns = arrify(patterns);
+
+ if (list.length === 0 || patterns.length === 0) {
+ return [];
+ }
+
+ let result = [];
+ for (const item of list) {
+ for (let pattern of patterns) {
+ let process = arrayUnion;
+
+ if (pattern[0] === '!') {
+ pattern = pattern.slice(1);
+ process = arrayDiffer;
+ }
+
+ result = process(result, minimatch.match([item], pattern, options));
+ }
+ }
+
+ return result;
+};
diff --git a/src/node_modules/multimatch/license b/src/node_modules/multimatch/license
new file mode 100644
index 0000000..fa7ceba
--- /dev/null
+++ b/src/node_modules/multimatch/license
@@ -0,0 +1,9 @@
+MIT License
+
+Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
+
+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/src/node_modules/multimatch/package.json b/src/node_modules/multimatch/package.json
new file mode 100644
index 0000000..15ef68b
--- /dev/null
+++ b/src/node_modules/multimatch/package.json
@@ -0,0 +1,48 @@
+{
+ "name": "multimatch",
+ "version": "5.0.0",
+ "description": "Extends `minimatch.match()` with support for multiple patterns",
+ "license": "MIT",
+ "repository": "sindresorhus/multimatch",
+ "funding": "https://github.com/sponsors/sindresorhus",
+ "author": {
+ "name": "Sindre Sorhus",
+ "email": "sindresorhus@gmail.com",
+ "url": "https://sindresorhus.com"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "scripts": {
+ "test": "xo && ava && tsd"
+ },
+ "files": [
+ "index.js",
+ "index.d.ts"
+ ],
+ "keywords": [
+ "expand",
+ "find",
+ "glob",
+ "globbing",
+ "globs",
+ "match",
+ "matcher",
+ "minimatch",
+ "pattern",
+ "patterns",
+ "wildcard"
+ ],
+ "dependencies": {
+ "@types/minimatch": "^3.0.3",
+ "array-differ": "^3.0.0",
+ "array-union": "^2.1.0",
+ "arrify": "^2.0.1",
+ "minimatch": "^3.0.4"
+ },
+ "devDependencies": {
+ "ava": "^2.4.0",
+ "tsd": "^0.13.1",
+ "xo": "^0.33.1"
+ }
+}
diff --git a/src/node_modules/multimatch/readme.md b/src/node_modules/multimatch/readme.md
new file mode 100644
index 0000000..6426d2e
--- /dev/null
+++ b/src/node_modules/multimatch/readme.md
@@ -0,0 +1,80 @@
+# multimatch [![Build Status](https://travis-ci.com/sindresorhus/multimatch.svg?branch=master)](https://travis-ci.com/github/sindresorhus/multimatch)
+
+> Extends [`minimatch.match()`](https://github.com/isaacs/minimatch#minimatchmatchlist-pattern-options) with support for multiple patterns
+
+## Install
+
+```
+$ npm install multimatch
+```
+
+## Usage
+
+```js
+const multimatch = require('multimatch');
+
+multimatch(['unicorn', 'cake', 'rainbows'], ['*', '!cake']);
+//=> ['unicorn', 'rainbows']
+```
+
+See the [tests](https://github.com/sindresorhus/multimatch/tree/master/test) for more usage examples and expected matches.
+
+## API
+
+### multimatch(paths, patterns, options?)
+
+Returns an array of matching paths in the order of input paths.
+
+#### paths
+
+Type: `string | string[]`
+
+Paths to match against.
+
+#### patterns
+
+Type: `string | string[]`
+
+Globbing patterns to use. For example: `['*', '!cake']`. See supported [`minimatch` patterns](https://github.com/isaacs/minimatch#usage).
+
+- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js)
+- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)
+
+#### options
+
+Type: `object`
+
+See the [`minimatch` options](https://github.com/isaacs/minimatch#options).
+
+## 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
+
+- [globby](https://github.com/sindresorhus/globby) - Match against the filesystem instead of a list
+- [matcher](https://github.com/sindresorhus/matcher) - Simple wildcard matching
+
+---
+
+<div align="center">
+ <b>
+ <a href="https://tidelift.com/subscription/pkg/npm-multimatch?utm_source=npm-multimatch&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
+ </b>
+ <br>
+ <sub>
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
+ </sub>
+</div>