summaryrefslogtreecommitdiff
path: root/node_modules/multimatch/index.js
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:50:21 +0800
committerlittleblack111 <littleblack11111@gmail.com>2023-10-14 15:50:21 +0800
commit0379526e20e1ff212df23e6326741aa9c06df204 (patch)
tree340143b0c4dc4280c88ba1591d137b53477005b3 /node_modules/multimatch/index.js
parent7aba14fb7c970c6e6af82c805db2aef6d70bfe2b (diff)
added doiuse plugin for postcss
Diffstat (limited to 'node_modules/multimatch/index.js')
-rw-r--r--node_modules/multimatch/index.js30
1 files changed, 30 insertions, 0 deletions
diff --git a/node_modules/multimatch/index.js b/node_modules/multimatch/index.js
new file mode 100644
index 00000000..a0833b52
--- /dev/null
+++ b/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;
+};