micromatch 4.0.3 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of micromatch might be problematic. Click here for more details.
- package/README.md +67 -58
- package/index.js +4 -4
- package/package.json +3 -3
package/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# micromatch [](https://www.npmjs.com/package/micromatch) [](https://npmjs.org/package/micromatch) [](https://npmjs.org/package/micromatch) [](https://travis-ci.org/micromatch/micromatch)
|
2
2
|
|
3
3
|
> Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.
|
4
4
|
|
@@ -93,7 +93,7 @@ console.log(micromatch.isMatch('foo', ['b*', 'f*'])) //=> true
|
|
93
93
|
* More complete support for the Bash 4.3 specification than minimatch and multimatch. Micromatch passes _all of the spec tests_ from bash, including some that bash still fails.
|
94
94
|
* **Fast & Performant** - Loads in about 5ms and performs [fast matches](#benchmarks).
|
95
95
|
* **Glob matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories
|
96
|
-
* **[Advanced globbing](#
|
96
|
+
* **[Advanced globbing](#extended-globbing)** - Supports [extglobs](#extglobs), [braces](#braces-1), and [POSIX brackets](#posix-bracket-expressions), and support for escaping special characters with `\` or quotes.
|
97
97
|
* **Accurate** - Covers more scenarios [than minimatch](https://github.com/yarnpkg/yarn/pull/3339)
|
98
98
|
* **Well tested** - More than 5,000 [test assertions](./test)
|
99
99
|
* **Windows support** - More reliable windows support than minimatch and multimatch.
|
@@ -142,9 +142,9 @@ console.log(micromatch(['foo', 'bar', 'baz'], ['f*', '*z'])); //=> ['foo', 'baz'
|
|
142
142
|
|
143
143
|
**Params**
|
144
144
|
|
145
|
-
* **{String|Array<string>}**:
|
146
|
-
* **{String|Array<string>}**:
|
147
|
-
* **{Object}**:
|
145
|
+
* `list` **{String|Array<string>}**: List of strings to match.
|
146
|
+
* `patterns` **{String|Array<string>}**: One or more glob patterns to use for matching.
|
147
|
+
* `options` **{Object}**: See available [options](#options)
|
148
148
|
* `returns` **{Array}**: Returns an array of matches
|
149
149
|
|
150
150
|
**Example**
|
@@ -157,7 +157,7 @@ console.log(mm(['a.js', 'a.txt'], ['*.js']));
|
|
157
157
|
//=> [ 'a.js' ]
|
158
158
|
```
|
159
159
|
|
160
|
-
### [.matcher](index.js#
|
160
|
+
### [.matcher](index.js#L104)
|
161
161
|
|
162
162
|
Returns a matcher function from the given glob `pattern` and `options`. The returned function takes a string to match as its only argument and returns true if the string is a match.
|
163
163
|
|
@@ -178,15 +178,15 @@ console.log(isMatch('a.a')); //=> false
|
|
178
178
|
console.log(isMatch('a.b')); //=> true
|
179
179
|
```
|
180
180
|
|
181
|
-
### [.isMatch](index.js#
|
181
|
+
### [.isMatch](index.js#L123)
|
182
182
|
|
183
183
|
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
184
184
|
|
185
185
|
**Params**
|
186
186
|
|
187
|
-
* **{String}**:
|
188
|
-
* **{String|Array}**:
|
189
|
-
* **{Object}**: See available [options](#options).
|
187
|
+
* `str` **{String}**: The string to test.
|
188
|
+
* `patterns` **{String|Array}**: One or more glob patterns to use for matching.
|
189
|
+
* `[options]` **{Object}**: See available [options](#options).
|
190
190
|
* `returns` **{Boolean}**: Returns true if any patterns match `str`
|
191
191
|
|
192
192
|
**Example**
|
@@ -199,7 +199,7 @@ console.log(mm.isMatch('a.a', ['b.*', '*.a'])); //=> true
|
|
199
199
|
console.log(mm.isMatch('a.a', 'b.*')); //=> false
|
200
200
|
```
|
201
201
|
|
202
|
-
### [.not](index.js#
|
202
|
+
### [.not](index.js#L148)
|
203
203
|
|
204
204
|
Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
205
205
|
|
@@ -220,7 +220,7 @@ console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
|
|
220
220
|
//=> ['b.b', 'c.c']
|
221
221
|
```
|
222
222
|
|
223
|
-
### [.contains](index.js#
|
223
|
+
### [.contains](index.js#L188)
|
224
224
|
|
225
225
|
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
226
226
|
|
@@ -229,7 +229,7 @@ Returns true if the given `string` contains the given pattern. Similar to [.isMa
|
|
229
229
|
* `str` **{String}**: The string to match.
|
230
230
|
* `patterns` **{String|Array}**: Glob pattern to use for matching.
|
231
231
|
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
|
232
|
-
* `returns` **{Boolean}**: Returns true if the
|
232
|
+
* `returns` **{Boolean}**: Returns true if any of the patterns matches any part of `str`.
|
233
233
|
|
234
234
|
**Example**
|
235
235
|
|
@@ -243,7 +243,7 @@ console.log(mm.contains('aa/bb/cc', '*d'));
|
|
243
243
|
//=> false
|
244
244
|
```
|
245
245
|
|
246
|
-
### [.matchKeys](index.js#
|
246
|
+
### [.matchKeys](index.js#L230)
|
247
247
|
|
248
248
|
Filter the keys of the given object with the given `glob` pattern and `options`. Does not attempt to match nested keys. If you need this feature, use [glob-object](https://github.com/jonschlinkert/glob-object) instead.
|
249
249
|
|
@@ -265,7 +265,7 @@ console.log(mm.matchKeys(obj, '*b'));
|
|
265
265
|
//=> { ab: 'b' }
|
266
266
|
```
|
267
267
|
|
268
|
-
### [.some](index.js#
|
268
|
+
### [.some](index.js#L259)
|
269
269
|
|
270
270
|
Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
271
271
|
|
@@ -274,7 +274,7 @@ Returns true if some of the strings in the given `list` match any of the given g
|
|
274
274
|
* `list` **{String|Array}**: The string or array of strings to test. Returns as soon as the first match is found.
|
275
275
|
* `patterns` **{String|Array}**: One or more glob patterns to use for matching.
|
276
276
|
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
|
277
|
-
* `returns` **{Boolean}**: Returns true if any patterns
|
277
|
+
* `returns` **{Boolean}**: Returns true if any `patterns` matches any of the strings in `list`
|
278
278
|
|
279
279
|
**Example**
|
280
280
|
|
@@ -288,7 +288,7 @@ console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
|
|
288
288
|
// false
|
289
289
|
```
|
290
290
|
|
291
|
-
### [.every](index.js#
|
291
|
+
### [.every](index.js#L295)
|
292
292
|
|
293
293
|
Returns true if every string in the given `list` matches any of the given glob `patterns`.
|
294
294
|
|
@@ -297,7 +297,7 @@ Returns true if every string in the given `list` matches any of the given glob `
|
|
297
297
|
* `list` **{String|Array}**: The string or array of strings to test.
|
298
298
|
* `patterns` **{String|Array}**: One or more glob patterns to use for matching.
|
299
299
|
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
|
300
|
-
* `returns` **{Boolean}**: Returns true if
|
300
|
+
* `returns` **{Boolean}**: Returns true if all `patterns` matches all of the strings in `list`
|
301
301
|
|
302
302
|
**Example**
|
303
303
|
|
@@ -315,7 +315,7 @@ console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
|
|
315
315
|
// false
|
316
316
|
```
|
317
317
|
|
318
|
-
### [.all](index.js#
|
318
|
+
### [.all](index.js#L334)
|
319
319
|
|
320
320
|
Returns true if **all** of the given `patterns` match the specified string.
|
321
321
|
|
@@ -345,7 +345,7 @@ console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
|
|
345
345
|
// true
|
346
346
|
```
|
347
347
|
|
348
|
-
### [.capture](index.js#
|
348
|
+
### [.capture](index.js#L361)
|
349
349
|
|
350
350
|
Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match.
|
351
351
|
|
@@ -354,7 +354,7 @@ Returns an array of matches captured by `pattern` in `string, or`null` if the pa
|
|
354
354
|
* `glob` **{String}**: Glob pattern to use for matching.
|
355
355
|
* `input` **{String}**: String to match
|
356
356
|
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
|
357
|
-
* `returns` **{
|
357
|
+
* `returns` **{Array|null}**: Returns an array of captures if the input matches the glob pattern, otherwise `null`.
|
358
358
|
|
359
359
|
**Example**
|
360
360
|
|
@@ -368,7 +368,7 @@ console.log(mm.capture('test/*.js', 'foo/bar.css'));
|
|
368
368
|
//=> null
|
369
369
|
```
|
370
370
|
|
371
|
-
### [.makeRe](index.js#
|
371
|
+
### [.makeRe](index.js#L387)
|
372
372
|
|
373
373
|
Create a regular expression from the given glob `pattern`.
|
374
374
|
|
@@ -388,7 +388,7 @@ console.log(mm.makeRe('*.js'));
|
|
388
388
|
//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
|
389
389
|
```
|
390
390
|
|
391
|
-
### [.scan](index.js#
|
391
|
+
### [.scan](index.js#L403)
|
392
392
|
|
393
393
|
Scan a glob pattern to separate the pattern into segments. Used by the [split](#split) method.
|
394
394
|
|
@@ -405,7 +405,7 @@ const mm = require('micromatch');
|
|
405
405
|
const state = mm.scan(pattern[, options]);
|
406
406
|
```
|
407
407
|
|
408
|
-
### [.parse](index.js#
|
408
|
+
### [.parse](index.js#L419)
|
409
409
|
|
410
410
|
Parse a glob pattern to create the source string for a regular expression.
|
411
411
|
|
@@ -422,7 +422,7 @@ const mm = require('micromatch');
|
|
422
422
|
const state = mm(pattern[, options]);
|
423
423
|
```
|
424
424
|
|
425
|
-
### [.braces](index.js#
|
425
|
+
### [.braces](index.js#L446)
|
426
426
|
|
427
427
|
Process the given brace `pattern`.
|
428
428
|
|
@@ -479,7 +479,7 @@ console.log(braces('foo/{a,b,c}/bar', { expand: true }));
|
|
479
479
|
| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
|
480
480
|
| `posix` | `boolean` | `false` | Support [POSIX character classes](#posix-bracket-expressions) ("posix brackets"). |
|
481
481
|
| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
|
482
|
-
| `prepend` | `
|
482
|
+
| `prepend` | `string` | `undefined` | String to prepend to the generated regex used for matching. |
|
483
483
|
| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
|
484
484
|
| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
|
485
485
|
| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
|
@@ -834,7 +834,7 @@ To solve this, you might be inspired to do something like `'foo\\*'.replace(/\\/
|
|
834
834
|
Install dependencies for running benchmarks:
|
835
835
|
|
836
836
|
```sh
|
837
|
-
$ cd bench && npm install
|
837
|
+
$ cd bench && npm install
|
838
838
|
```
|
839
839
|
|
840
840
|
Run the benchmarks:
|
@@ -845,56 +845,56 @@ $ npm run bench
|
|
845
845
|
|
846
846
|
### Latest results
|
847
847
|
|
848
|
-
As of April 10,
|
848
|
+
As of April 10, 2021 (longer bars are better):
|
849
849
|
|
850
850
|
```sh
|
851
851
|
# .makeRe star
|
852
|
-
micromatch x
|
853
|
-
minimatch x
|
852
|
+
micromatch x 2,232,802 ops/sec ±2.34% (89 runs sampled))
|
853
|
+
minimatch x 781,018 ops/sec ±6.74% (92 runs sampled))
|
854
854
|
|
855
855
|
# .makeRe star; dot=true
|
856
|
-
micromatch x 1,
|
857
|
-
minimatch x
|
856
|
+
micromatch x 1,863,453 ops/sec ±0.74% (93 runs sampled)
|
857
|
+
minimatch x 723,105 ops/sec ±0.75% (93 runs sampled)
|
858
858
|
|
859
859
|
# .makeRe globstar
|
860
|
-
micromatch x 1,
|
861
|
-
minimatch x 1,
|
860
|
+
micromatch x 1,624,179 ops/sec ±2.22% (91 runs sampled)
|
861
|
+
minimatch x 1,117,230 ops/sec ±2.78% (86 runs sampled))
|
862
862
|
|
863
863
|
# .makeRe globstars
|
864
|
-
micromatch x 1,
|
865
|
-
minimatch x
|
864
|
+
micromatch x 1,658,642 ops/sec ±0.86% (92 runs sampled)
|
865
|
+
minimatch x 741,224 ops/sec ±1.24% (89 runs sampled))
|
866
866
|
|
867
867
|
# .makeRe with leading star
|
868
|
-
micromatch x 1,
|
869
|
-
minimatch x
|
868
|
+
micromatch x 1,525,014 ops/sec ±1.63% (90 runs sampled)
|
869
|
+
minimatch x 561,074 ops/sec ±3.07% (89 runs sampled)
|
870
870
|
|
871
871
|
# .makeRe - braces
|
872
|
-
micromatch x
|
873
|
-
minimatch x
|
872
|
+
micromatch x 172,478 ops/sec ±2.37% (78 runs sampled)
|
873
|
+
minimatch x 96,087 ops/sec ±2.34% (88 runs sampled)))
|
874
874
|
|
875
875
|
# .makeRe braces - range (expanded)
|
876
|
-
micromatch x
|
877
|
-
minimatch x
|
876
|
+
micromatch x 26,973 ops/sec ±0.84% (89 runs sampled)
|
877
|
+
minimatch x 3,023 ops/sec ±0.99% (90 runs sampled))
|
878
878
|
|
879
879
|
# .makeRe braces - range (compiled)
|
880
|
-
micromatch x
|
881
|
-
minimatch x
|
880
|
+
micromatch x 152,892 ops/sec ±1.67% (83 runs sampled)
|
881
|
+
minimatch x 992 ops/sec ±3.50% (89 runs sampled)d))
|
882
882
|
|
883
883
|
# .makeRe braces - nested ranges (expanded)
|
884
|
-
micromatch x
|
885
|
-
minimatch x
|
884
|
+
micromatch x 15,816 ops/sec ±13.05% (80 runs sampled)
|
885
|
+
minimatch x 2,953 ops/sec ±1.64% (91 runs sampled)
|
886
886
|
|
887
887
|
# .makeRe braces - nested ranges (compiled)
|
888
|
-
micromatch x
|
889
|
-
minimatch x
|
888
|
+
micromatch x 110,881 ops/sec ±1.85% (82 runs sampled)
|
889
|
+
minimatch x 1,008 ops/sec ±1.51% (91 runs sampled)
|
890
890
|
|
891
891
|
# .makeRe braces - set (compiled)
|
892
|
-
micromatch x
|
893
|
-
minimatch x 43,
|
892
|
+
micromatch x 134,930 ops/sec ±3.54% (63 runs sampled))
|
893
|
+
minimatch x 43,242 ops/sec ±0.60% (93 runs sampled)
|
894
894
|
|
895
895
|
# .makeRe braces - nested sets (compiled)
|
896
|
-
micromatch x
|
897
|
-
minimatch x
|
896
|
+
micromatch x 94,455 ops/sec ±1.74% (69 runs sampled))
|
897
|
+
minimatch x 27,720 ops/sec ±1.84% (93 runs sampled))
|
898
898
|
```
|
899
899
|
|
900
900
|
## Contributing
|
@@ -963,23 +963,32 @@ You might also be interested in these projects:
|
|
963
963
|
|
964
964
|
| **Commits** | **Contributor** |
|
965
965
|
| --- | --- |
|
966
|
-
|
|
966
|
+
| 508 | [jonschlinkert](https://github.com/jonschlinkert) |
|
967
967
|
| 12 | [es128](https://github.com/es128) |
|
968
968
|
| 8 | [doowb](https://github.com/doowb) |
|
969
|
-
|
|
969
|
+
| 6 | [paulmillr](https://github.com/paulmillr) |
|
970
|
+
| 5 | [mrmlnc](https://github.com/mrmlnc) |
|
971
|
+
| 4 | [danez](https://github.com/danez) |
|
972
|
+
| 3 | [DrPizza](https://github.com/DrPizza) |
|
970
973
|
| 2 | [TrySound](https://github.com/TrySound) |
|
974
|
+
| 2 | [mceIdo](https://github.com/mceIdo) |
|
975
|
+
| 2 | [Glazy](https://github.com/Glazy) |
|
971
976
|
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
|
972
977
|
| 2 | [Tvrqvoise](https://github.com/Tvrqvoise) |
|
973
|
-
| 2 | [tunnckoCore](https://github.com/tunnckoCore) |
|
974
978
|
| 1 | [amilajack](https://github.com/amilajack) |
|
975
|
-
| 1 | [
|
979
|
+
| 1 | [Cslove](https://github.com/Cslove) |
|
976
980
|
| 1 | [devongovett](https://github.com/devongovett) |
|
977
981
|
| 1 | [DianeLooney](https://github.com/DianeLooney) |
|
978
982
|
| 1 | [UltCombo](https://github.com/UltCombo) |
|
983
|
+
| 1 | [frangio](https://github.com/frangio) |
|
984
|
+
| 1 | [juszczykjakub](https://github.com/juszczykjakub) |
|
985
|
+
| 1 | [muescha](https://github.com/muescha) |
|
986
|
+
| 1 | [sebdeckers](https://github.com/sebdeckers) |
|
979
987
|
| 1 | [tomByrer](https://github.com/tomByrer) |
|
980
988
|
| 1 | [fidian](https://github.com/fidian) |
|
981
989
|
| 1 | [simlu](https://github.com/simlu) |
|
982
990
|
| 1 | [wtgtybhertgeghgtwtg](https://github.com/wtgtybhertgeghgtwtg) |
|
991
|
+
| 1 | [yvele](https://github.com/yvele) |
|
983
992
|
|
984
993
|
### Author
|
985
994
|
|
@@ -991,9 +1000,9 @@ You might also be interested in these projects:
|
|
991
1000
|
|
992
1001
|
### License
|
993
1002
|
|
994
|
-
Copyright ©
|
1003
|
+
Copyright © 2021, [Jon Schlinkert](https://github.com/jonschlinkert).
|
995
1004
|
Released under the [MIT License](LICENSE).
|
996
1005
|
|
997
1006
|
***
|
998
1007
|
|
999
|
-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 10,
|
1008
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.8.0, on April 10, 2021._
|
package/index.js
CHANGED
@@ -181,7 +181,7 @@ micromatch.not = (list, patterns, options = {}) => {
|
|
181
181
|
* @param {String} `str` The string to match.
|
182
182
|
* @param {String|Array} `patterns` Glob pattern to use for matching.
|
183
183
|
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
184
|
-
* @return {Boolean} Returns true if the
|
184
|
+
* @return {Boolean} Returns true if any of the patterns matches any part of `str`.
|
185
185
|
* @api public
|
186
186
|
*/
|
187
187
|
|
@@ -252,7 +252,7 @@ micromatch.matchKeys = (obj, patterns, options) => {
|
|
252
252
|
* @param {String|Array} `list` The string or array of strings to test. Returns as soon as the first match is found.
|
253
253
|
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
254
254
|
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
255
|
-
* @return {Boolean} Returns true if any patterns
|
255
|
+
* @return {Boolean} Returns true if any `patterns` matches any of the strings in `list`
|
256
256
|
* @api public
|
257
257
|
*/
|
258
258
|
|
@@ -288,7 +288,7 @@ micromatch.some = (list, patterns, options) => {
|
|
288
288
|
* @param {String|Array} `list` The string or array of strings to test.
|
289
289
|
* @param {String|Array} `patterns` One or more glob patterns to use for matching.
|
290
290
|
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
291
|
-
* @return {Boolean} Returns true if
|
291
|
+
* @return {Boolean} Returns true if all `patterns` matches all of the strings in `list`
|
292
292
|
* @api public
|
293
293
|
*/
|
294
294
|
|
@@ -354,7 +354,7 @@ micromatch.all = (str, patterns, options) => {
|
|
354
354
|
* @param {String} `glob` Glob pattern to use for matching.
|
355
355
|
* @param {String} `input` String to match
|
356
356
|
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
357
|
-
* @return {
|
357
|
+
* @return {Array|null} Returns an array of captures if the input matches the glob pattern, otherwise `null`.
|
358
358
|
* @api public
|
359
359
|
*/
|
360
360
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "micromatch",
|
3
3
|
"description": "Glob matching for javascript/node.js. A replacement and faster alternative to minimatch and multimatch.",
|
4
|
-
"version": "4.0.
|
4
|
+
"version": "4.0.4",
|
5
5
|
"homepage": "https://github.com/micromatch/micromatch",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"contributors": [
|
@@ -38,13 +38,13 @@
|
|
38
38
|
},
|
39
39
|
"dependencies": {
|
40
40
|
"braces": "^3.0.1",
|
41
|
-
"picomatch": "^2.2.
|
41
|
+
"picomatch": "^2.2.3"
|
42
42
|
},
|
43
43
|
"devDependencies": {
|
44
44
|
"fill-range": "^7.0.1",
|
45
45
|
"gulp-format-md": "^2.0.0",
|
46
46
|
"minimatch": "^3.0.4",
|
47
|
-
"mocha": "^
|
47
|
+
"mocha": "^7.2.0",
|
48
48
|
"time-require": "github:jonschlinkert/time-require"
|
49
49
|
},
|
50
50
|
"keywords": [
|