micromatch 3.0.2 → 3.1.0
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/CHANGELOG.md +1 -1
- package/LICENSE +1 -1
- package/README.md +137 -74
- package/index.js +40 -3
- package/lib/.DS_Store +0 -0
- package/lib/compilers.js +0 -1
- package/package.json +30 -30
package/CHANGELOG.md
CHANGED
@@ -13,7 +13,7 @@ Changelog entries are classified using the following labels _(from [keep-a-chang
|
|
13
13
|
|
14
14
|
### [3.0.0] - 2017-04-11
|
15
15
|
|
16
|
-
TODO
|
16
|
+
TODO. There should be no breaking changes. Please report any regressions. I will [reformat these release notes](https://github.com/micromatch/micromatch/pull/76) and add them to the changelog as soon as I have a chance.
|
17
17
|
|
18
18
|
### [1.0.1] - 2016-12-12
|
19
19
|
|
package/LICENSE
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c) 2014-2017, Jon Schlinkert
|
3
|
+
Copyright (c) 2014-2017, Jon Schlinkert.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
@@ -2,8 +2,12 @@
|
|
2
2
|
|
3
3
|
> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
|
4
4
|
|
5
|
+
Follow this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), for updates on this project and others.
|
6
|
+
|
7
|
+
## Table of Contents
|
8
|
+
|
5
9
|
<details>
|
6
|
-
<summary><strong>
|
10
|
+
<summary><strong>Details</strong></summary>
|
7
11
|
|
8
12
|
- [Install](#install)
|
9
13
|
- [Quickstart](#quickstart)
|
@@ -87,8 +91,8 @@ console.log(mm.isMatch('foo', 'f*'));
|
|
87
91
|
|
88
92
|
* Supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
|
89
93
|
* Micromatch uses [snapdragon](https://github.com/jonschlinkert/snapdragon) for parsing and compiling globs, which provides granular control over the entire conversion process in a way that is easy to understand, reason about, and maintain.
|
90
|
-
* More accurate, with more than 36,000 [test assertions](./test) to prove it.
|
91
|
-
* More complete support for the Bash 4.3 specification than minimatch and multimatch.
|
94
|
+
* More consistently accurate matching [than minimatch](https://github.com/yarnpkg/yarn/pull/3339), with more than 36,000 [test assertions](./test) to prove it.
|
95
|
+
* More complete support for the Bash 4.3 specification than minimatch and multimatch. In fact, micromatch passes _all of the spec tests_ from bash, including some that bash still fails.
|
92
96
|
* [Faster matching](#benchmarks), from a combination of optimized glob patterns, faster algorithms, and regex caching.
|
93
97
|
* [Micromatch is safer](https://github.com/micromatch/braces#braces-is-safe), and is not subject to DoS with brace patterns, like minimatch and multimatch.
|
94
98
|
* More reliable windows support than minimatch and multimatch.
|
@@ -158,7 +162,7 @@ console.log(mm(['a.js', 'a.txt'], ['*.js']));
|
|
158
162
|
//=> [ 'a.js' ]
|
159
163
|
```
|
160
164
|
|
161
|
-
### [.match](index.js#
|
165
|
+
### [.match](index.js#L93)
|
162
166
|
|
163
167
|
Similar to the main function, but `pattern` must be a string.
|
164
168
|
|
@@ -179,7 +183,7 @@ console.log(mm.match(['a.a', 'a.aa', 'a.b', 'a.c'], '*.a'));
|
|
179
183
|
//=> ['a.a', 'a.aa']
|
180
184
|
```
|
181
185
|
|
182
|
-
### [.isMatch](index.js#
|
186
|
+
### [.isMatch](index.js#L154)
|
183
187
|
|
184
188
|
Returns true if the specified `string` matches the given glob `pattern`.
|
185
189
|
|
@@ -202,7 +206,7 @@ console.log(mm.isMatch('a.b', '*.a'));
|
|
202
206
|
//=> false
|
203
207
|
```
|
204
208
|
|
205
|
-
### [.some](index.js#
|
209
|
+
### [.some](index.js#L192)
|
206
210
|
|
207
211
|
Returns true if some of the strings in the given `list` match any of the given glob `patterns`.
|
208
212
|
|
@@ -225,7 +229,7 @@ console.log(mm.some(['foo.js'], ['*.js', '!foo.js']));
|
|
225
229
|
// false
|
226
230
|
```
|
227
231
|
|
228
|
-
### [.every](index.js#
|
232
|
+
### [.every](index.js#L228)
|
229
233
|
|
230
234
|
Returns true if every string in the given `list` matches any of the given glob `patterns`.
|
231
235
|
|
@@ -252,7 +256,7 @@ console.log(mm.every(['foo.js'], ['*.js', '!foo.js']));
|
|
252
256
|
// false
|
253
257
|
```
|
254
258
|
|
255
|
-
### [.any](index.js#
|
259
|
+
### [.any](index.js#L260)
|
256
260
|
|
257
261
|
Returns true if **any** of the given glob `patterns` match the specified `string`.
|
258
262
|
|
@@ -275,7 +279,7 @@ console.log(mm.any('a.a', 'b.*'));
|
|
275
279
|
//=> false
|
276
280
|
```
|
277
281
|
|
278
|
-
### [.all](index.js#
|
282
|
+
### [.all](index.js#L308)
|
279
283
|
|
280
284
|
Returns true if **all** of the given `patterns` match the specified string.
|
281
285
|
|
@@ -305,7 +309,7 @@ console.log(mm.all('foo.js', ['*.js', 'f*', '*o*', '*o.js']));
|
|
305
309
|
// true
|
306
310
|
```
|
307
311
|
|
308
|
-
### [.not](index.js#
|
312
|
+
### [.not](index.js#L340)
|
309
313
|
|
310
314
|
Returns a list of strings that _**do not match any**_ of the given `patterns`.
|
311
315
|
|
@@ -326,7 +330,7 @@ console.log(mm.not(['a.a', 'b.b', 'c.c'], '*.a'));
|
|
326
330
|
//=> ['b.b', 'c.c']
|
327
331
|
```
|
328
332
|
|
329
|
-
### [.contains](index.js#
|
333
|
+
### [.contains](index.js#L376)
|
330
334
|
|
331
335
|
Returns true if the given `string` contains the given pattern. Similar to [.isMatch](#isMatch) but the pattern can match any part of the string.
|
332
336
|
|
@@ -349,7 +353,7 @@ console.log(mm.contains('aa/bb/cc', '*d'));
|
|
349
353
|
//=> false
|
350
354
|
```
|
351
355
|
|
352
|
-
### [.matchKeys](index.js#
|
356
|
+
### [.matchKeys](index.js#L432)
|
353
357
|
|
354
358
|
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.
|
355
359
|
|
@@ -371,7 +375,7 @@ console.log(mm.matchKeys(obj, '*b'));
|
|
371
375
|
//=> { ab: 'b' }
|
372
376
|
```
|
373
377
|
|
374
|
-
### [.matcher](index.js#
|
378
|
+
### [.matcher](index.js#L461)
|
375
379
|
|
376
380
|
Returns a memoized 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.
|
377
381
|
|
@@ -394,7 +398,30 @@ console.log(isMatch('a.b'));
|
|
394
398
|
//=> true
|
395
399
|
```
|
396
400
|
|
397
|
-
### [.
|
401
|
+
### [.capture](index.js#L536)
|
402
|
+
|
403
|
+
Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match.
|
404
|
+
|
405
|
+
**Params**
|
406
|
+
|
407
|
+
* `pattern` **{String}**: Glob pattern to use for matching.
|
408
|
+
* `string` **{String}**: String to match
|
409
|
+
* `options` **{Object}**: See available [options](#options) for changing how matches are performed
|
410
|
+
* `returns` **{Boolean}**: Returns an array of captures if the string matches the glob pattern, otherwise `null`.
|
411
|
+
|
412
|
+
**Example**
|
413
|
+
|
414
|
+
```js
|
415
|
+
var mm = require('micromatch');
|
416
|
+
mm.capture(pattern, string[, options]);
|
417
|
+
|
418
|
+
console.log(mm.capture('test/*.js', 'test/foo.js));
|
419
|
+
//=> ['foo']
|
420
|
+
console.log(mm.capture('test/*.js', 'foo/bar.css'));
|
421
|
+
//=> null
|
422
|
+
```
|
423
|
+
|
424
|
+
### [.makeRe](index.js#L571)
|
398
425
|
|
399
426
|
Create a regular expression from the given glob `pattern`.
|
400
427
|
|
@@ -414,7 +441,7 @@ console.log(mm.makeRe('*.js'));
|
|
414
441
|
//=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/
|
415
442
|
```
|
416
443
|
|
417
|
-
### [.braces](index.js#
|
444
|
+
### [.braces](index.js#L618)
|
418
445
|
|
419
446
|
Expand the given brace `pattern`.
|
420
447
|
|
@@ -435,7 +462,7 @@ console.log(mm.braces('foo/{a,b}/bar', {expand: true}));
|
|
435
462
|
//=> ['foo/(a|b)/bar']
|
436
463
|
```
|
437
464
|
|
438
|
-
### [.create](index.js#
|
465
|
+
### [.create](index.js#L685)
|
439
466
|
|
440
467
|
Parses the given glob `pattern` and returns an array of abstract syntax trees (ASTs), with the compiled `output` and optional source `map` on each AST.
|
441
468
|
|
@@ -477,7 +504,7 @@ console.log(mm.create('abc/*.js'));
|
|
477
504
|
// idx: 6 }]
|
478
505
|
```
|
479
506
|
|
480
|
-
### [.parse](index.js#
|
507
|
+
### [.parse](index.js#L732)
|
481
508
|
|
482
509
|
Parse the given `str` with the given `options`.
|
483
510
|
|
@@ -510,7 +537,7 @@ console.log(ast);
|
|
510
537
|
// { type: 'eos', val: '' } ] }
|
511
538
|
```
|
512
539
|
|
513
|
-
### [.compile](index.js#
|
540
|
+
### [.compile](index.js#L785)
|
514
541
|
|
515
542
|
Compile the given `ast` or string with the given `options`.
|
516
543
|
|
@@ -544,7 +571,7 @@ console.log(mm.compile(ast));
|
|
544
571
|
// parsingErrors: [] }
|
545
572
|
```
|
546
573
|
|
547
|
-
### [.clearCache](index.js#
|
574
|
+
### [.clearCache](index.js#L806)
|
548
575
|
|
549
576
|
Clear the regex cache.
|
550
577
|
|
@@ -953,70 +980,105 @@ npm i -d && npm run benchmark
|
|
953
980
|
|
954
981
|
### Latest results
|
955
982
|
|
956
|
-
As of
|
983
|
+
As of September 11, 2017 (longer bars are better):
|
957
984
|
|
958
985
|
```sh
|
959
|
-
# braces-globstar-large-list
|
960
|
-
micromatch ██████████████████████████████████████████████████ (
|
961
|
-
minimatch █ (
|
962
|
-
multimatch █ (
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
multimatch ███ (11,841 ops/sec)
|
973
|
-
|
974
|
-
# braces-set
|
975
|
-
micromatch ██████████████████████████████████████████████████ (24,344 ops/sec)
|
976
|
-
minimatch ████ (2,255 ops/sec)
|
977
|
-
multimatch ████ (2,199 ops/sec)
|
978
|
-
|
979
|
-
# globstar-large-list
|
980
|
-
micromatch ██████████████████████████████████████████████████ (561 ops/sec)
|
981
|
-
minimatch ██ (25.43 ops/sec)
|
982
|
-
multimatch ██ (25.27 ops/sec)
|
983
|
-
|
984
|
-
# globstar-long-list
|
985
|
-
micromatch ██████████████████████████████████████████████████ (3,257 ops/sec)
|
986
|
-
minimatch ███████ (485 ops/sec)
|
987
|
-
multimatch ███████ (485 ops/sec)
|
988
|
-
|
989
|
-
# globstar-short-list
|
990
|
-
micromatch ██████████████████████████████████████████████████ (359,991 ops/sec)
|
991
|
-
minimatch ██████ (44,763 ops/sec)
|
992
|
-
multimatch █████ (39,977 ops/sec)
|
993
|
-
|
994
|
-
# no-glob
|
995
|
-
micromatch ██████████████████████████████████████████████████ (443,740 ops/sec)
|
996
|
-
minimatch ████ (44,152 ops/sec)
|
997
|
-
multimatch ████ (41,077 ops/sec)
|
998
|
-
|
999
|
-
# star-basename
|
1000
|
-
micromatch ██████████████████████████████████████████████████ (10,286 ops/sec)
|
1001
|
-
minimatch ██████████████ (3,059 ops/sec)
|
1002
|
-
multimatch ███████████████ (3,129 ops/sec)
|
1003
|
-
|
1004
|
-
# star
|
1005
|
-
micromatch ██████████████████████████████████████████████████ (9,756 ops/sec)
|
1006
|
-
minimatch ███████████████ (2,978 ops/sec)
|
1007
|
-
multimatch ███████████████ (2,970 ops/sec)
|
986
|
+
# braces-globstar-large-list (485691 bytes)
|
987
|
+
micromatch ██████████████████████████████████████████████████ (517 ops/sec ±0.49%)
|
988
|
+
minimatch █ (18.92 ops/sec ±0.54%)
|
989
|
+
multimatch █ (18.94 ops/sec ±0.62%)
|
990
|
+
|
991
|
+
micromatch is faster by an avg. of 2,733%
|
992
|
+
|
993
|
+
# braces-multiple (3362 bytes)
|
994
|
+
micromatch ██████████████████████████████████████████████████ (33,625 ops/sec ±0.45%)
|
995
|
+
minimatch (2.92 ops/sec ±3.26%)
|
996
|
+
multimatch (2.90 ops/sec ±2.76%)
|
997
|
+
|
998
|
+
micromatch is faster by an avg. of 1,156,935%
|
1008
999
|
|
1000
|
+
# braces-range (727 bytes)
|
1001
|
+
micromatch █████████████████████████████████████████████████ (155,220 ops/sec ±0.56%)
|
1002
|
+
minimatch ██████ (20,186 ops/sec ±1.27%)
|
1003
|
+
multimatch ██████ (19,809 ops/sec ±0.60%)
|
1004
|
+
|
1005
|
+
micromatch is faster by an avg. of 776%
|
1006
|
+
|
1007
|
+
# braces-set (2858 bytes)
|
1008
|
+
micromatch █████████████████████████████████████████████████ (24,354 ops/sec ±0.92%)
|
1009
|
+
minimatch █████ (2,566 ops/sec ±0.56%)
|
1010
|
+
multimatch ████ (2,431 ops/sec ±1.25%)
|
1011
|
+
|
1012
|
+
micromatch is faster by an avg. of 975%
|
1013
|
+
|
1014
|
+
# globstar-large-list (485686 bytes)
|
1015
|
+
micromatch █████████████████████████████████████████████████ (504 ops/sec ±0.45%)
|
1016
|
+
minimatch ███ (33.36 ops/sec ±1.08%)
|
1017
|
+
multimatch ███ (33.19 ops/sec ±1.35%)
|
1018
|
+
|
1019
|
+
micromatch is faster by an avg. of 1,514%
|
1020
|
+
|
1021
|
+
# globstar-long-list (90647 bytes)
|
1022
|
+
micromatch ██████████████████████████████████████████████████ (2,694 ops/sec ±1.08%)
|
1023
|
+
minimatch ████████████████ (870 ops/sec ±1.09%)
|
1024
|
+
multimatch ████████████████ (862 ops/sec ±0.84%)
|
1025
|
+
|
1026
|
+
micromatch is faster by an avg. of 311%
|
1027
|
+
|
1028
|
+
# globstar-short-list (182 bytes)
|
1029
|
+
micromatch ██████████████████████████████████████████████████ (328,921 ops/sec ±1.06%)
|
1030
|
+
minimatch █████████ (64,808 ops/sec ±1.42%)
|
1031
|
+
multimatch ████████ (57,991 ops/sec ±2.11%)
|
1032
|
+
|
1033
|
+
micromatch is faster by an avg. of 536%
|
1034
|
+
|
1035
|
+
# no-glob (701 bytes)
|
1036
|
+
micromatch █████████████████████████████████████████████████ (415,935 ops/sec ±0.36%)
|
1037
|
+
minimatch ███████████ (92,730 ops/sec ±1.44%)
|
1038
|
+
multimatch █████████ (81,958 ops/sec ±2.13%)
|
1039
|
+
|
1040
|
+
micromatch is faster by an avg. of 476%
|
1041
|
+
|
1042
|
+
# star-basename-long (12339 bytes)
|
1043
|
+
micromatch █████████████████████████████████████████████████ (7,963 ops/sec ±0.36%)
|
1044
|
+
minimatch ███████████████████████████████ (5,072 ops/sec ±0.83%)
|
1045
|
+
multimatch ███████████████████████████████ (5,028 ops/sec ±0.40%)
|
1046
|
+
|
1047
|
+
micromatch is faster by an avg. of 158%
|
1048
|
+
|
1049
|
+
# star-basename-short (349 bytes)
|
1050
|
+
micromatch ██████████████████████████████████████████████████ (269,552 ops/sec ±0.70%)
|
1051
|
+
minimatch ██████████████████████ (122,457 ops/sec ±1.39%)
|
1052
|
+
multimatch ████████████████████ (110,788 ops/sec ±1.99%)
|
1053
|
+
|
1054
|
+
micromatch is faster by an avg. of 231%
|
1055
|
+
|
1056
|
+
# star-folder-long (19207 bytes)
|
1057
|
+
micromatch █████████████████████████████████████████████████ (3,806 ops/sec ±0.38%)
|
1058
|
+
minimatch ████████████████████████████ (2,204 ops/sec ±0.32%)
|
1059
|
+
multimatch ██████████████████████████ (2,020 ops/sec ±1.07%)
|
1060
|
+
|
1061
|
+
micromatch is faster by an avg. of 180%
|
1062
|
+
|
1063
|
+
# star-folder-short (551 bytes)
|
1064
|
+
micromatch ██████████████████████████████████████████████████ (249,077 ops/sec ±0.40%)
|
1065
|
+
minimatch ███████████ (59,431 ops/sec ±1.67%)
|
1066
|
+
multimatch ███████████ (55,569 ops/sec ±1.43%)
|
1067
|
+
|
1068
|
+
micromatch is faster by an avg. of 433%
|
1009
1069
|
```
|
1010
1070
|
|
1011
1071
|
## About
|
1012
1072
|
|
1013
1073
|
### Related projects
|
1014
1074
|
|
1075
|
+
You might also be interested in these projects:
|
1076
|
+
|
1015
1077
|
* [braces](https://www.npmjs.com/package/braces): Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support… [more](https://github.com/micromatch/braces) | [homepage](https://github.com/micromatch/braces "Bash-like brace expansion, implemented in JavaScript. Safer than other brace expansion libs, with complete support for the Bash 4.3 braces specification, without sacrificing speed.")
|
1016
1078
|
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/jonschlinkert/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.")
|
1017
1079
|
* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.")
|
1018
1080
|
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or `step` to… [more](https://github.com/jonschlinkert/fill-range) | [homepage](https://github.com/jonschlinkert/fill-range "Fill in a range of numbers or letters, optionally passing an increment or `step` to use, or create a regex-compatible range with `options.toRegex`")
|
1019
|
-
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/
|
1081
|
+
* [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces)")
|
1020
1082
|
|
1021
1083
|
### Contributing
|
1022
1084
|
|
@@ -1028,17 +1090,18 @@ Please read the [contributing guide](.github/contributing.md) for advice on open
|
|
1028
1090
|
|
1029
1091
|
| **Commits** | **Contributor** |
|
1030
1092
|
| --- | --- |
|
1031
|
-
|
|
1093
|
+
| 439 | [jonschlinkert](https://github.com/jonschlinkert) |
|
1032
1094
|
| 12 | [es128](https://github.com/es128) |
|
1095
|
+
| 8 | [doowb](https://github.com/doowb) |
|
1033
1096
|
| 3 | [paulmillr](https://github.com/paulmillr) |
|
1034
1097
|
| 2 | [TrySound](https://github.com/TrySound) |
|
1035
|
-
| 2 | [doowb](https://github.com/doowb) |
|
1036
1098
|
| 2 | [MartinKolarik](https://github.com/MartinKolarik) |
|
1037
|
-
| 2 | [
|
1099
|
+
| 2 | [charlike](https://github.com/charlike) |
|
1038
1100
|
| 1 | [amilajack](https://github.com/amilajack) |
|
1039
1101
|
| 1 | [DianeLooney](https://github.com/DianeLooney) |
|
1040
1102
|
| 1 | [UltCombo](https://github.com/UltCombo) |
|
1041
1103
|
| 1 | [tomByrer](https://github.com/tomByrer) |
|
1104
|
+
| 1 | [fidian](https://github.com/fidian) |
|
1042
1105
|
|
1043
1106
|
### Building docs
|
1044
1107
|
|
@@ -1072,4 +1135,4 @@ Released under the [MIT License](LICENSE).
|
|
1072
1135
|
|
1073
1136
|
***
|
1074
1137
|
|
1075
|
-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on
|
1138
|
+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on September 11, 2017._
|
package/index.js
CHANGED
@@ -51,7 +51,6 @@ function micromatch(list, patterns, options) {
|
|
51
51
|
return micromatch.match(list, patterns[0], options);
|
52
52
|
}
|
53
53
|
|
54
|
-
var negated = false;
|
55
54
|
var omit = [];
|
56
55
|
var keep = [];
|
57
56
|
var idx = -1;
|
@@ -61,7 +60,6 @@ function micromatch(list, patterns, options) {
|
|
61
60
|
|
62
61
|
if (typeof pattern === 'string' && pattern.charCodeAt(0) === 33 /* ! */) {
|
63
62
|
omit.push.apply(omit, micromatch.match(list, pattern.slice(1), options));
|
64
|
-
negated = true;
|
65
63
|
} else {
|
66
64
|
keep.push.apply(keep, micromatch.match(list, pattern, options));
|
67
65
|
}
|
@@ -344,7 +342,8 @@ micromatch.not = function(list, patterns, options) {
|
|
344
342
|
var ignore = opts.ignore;
|
345
343
|
delete opts.ignore;
|
346
344
|
|
347
|
-
|
345
|
+
var unixify = utils.unixify(opts);
|
346
|
+
list = utils.arrayify(list).map(unixify);
|
348
347
|
|
349
348
|
var matches = utils.diff(list, micromatch(list, patterns, opts));
|
350
349
|
if (ignore) {
|
@@ -515,6 +514,44 @@ micromatch.matcher = function matcher(pattern, options) {
|
|
515
514
|
return fn;
|
516
515
|
};
|
517
516
|
|
517
|
+
/**
|
518
|
+
* Returns an array of matches captured by `pattern` in `string, or `null` if the pattern did not match.
|
519
|
+
*
|
520
|
+
* ```js
|
521
|
+
* var mm = require('micromatch');
|
522
|
+
* mm.capture(pattern, string[, options]);
|
523
|
+
*
|
524
|
+
* console.log(mm.capture('test/*.js', 'test/foo.js));
|
525
|
+
* //=> ['foo']
|
526
|
+
* console.log(mm.capture('test/*.js', 'foo/bar.css'));
|
527
|
+
* //=> null
|
528
|
+
* ```
|
529
|
+
* @param {String} `pattern` Glob pattern to use for matching.
|
530
|
+
* @param {String} `string` String to match
|
531
|
+
* @param {Object} `options` See available [options](#options) for changing how matches are performed
|
532
|
+
* @return {Boolean} Returns an array of captures if the string matches the glob pattern, otherwise `null`.
|
533
|
+
* @api public
|
534
|
+
*/
|
535
|
+
|
536
|
+
micromatch.capture = function(pattern, str, options) {
|
537
|
+
var re = micromatch.makeRe(pattern, extend({capture: true}, options));
|
538
|
+
var unixify = utils.unixify(options);
|
539
|
+
|
540
|
+
function match() {
|
541
|
+
return function(string) {
|
542
|
+
var match = re.exec(unixify(string));
|
543
|
+
if (!match) {
|
544
|
+
return null;
|
545
|
+
}
|
546
|
+
|
547
|
+
return match.slice(1);
|
548
|
+
};
|
549
|
+
}
|
550
|
+
|
551
|
+
var capture = memoize('capture', pattern, options, match);
|
552
|
+
return capture(str);
|
553
|
+
};
|
554
|
+
|
518
555
|
/**
|
519
556
|
* Create a regular expression from the given glob `pattern`.
|
520
557
|
*
|
package/lib/.DS_Store
ADDED
Binary file
|
package/lib/compilers.js
CHANGED
@@ -19,7 +19,6 @@ module.exports = function(snapdragon) {
|
|
19
19
|
var text = compilers.text;
|
20
20
|
var plus = compilers.plus;
|
21
21
|
var dot = compilers.dot;
|
22
|
-
var eos = compilers.eos;
|
23
22
|
|
24
23
|
// register extglob compilers or escape exglobs if disabled
|
25
24
|
if (opts.extglob === false || opts.noext === true) {
|
package/package.json
CHANGED
@@ -1,20 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"name": "micromatch",
|
3
3
|
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
|
4
|
-
"version": "3.0
|
4
|
+
"version": "3.1.0",
|
5
5
|
"homepage": "https://github.com/micromatch/micromatch",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"contributors": [
|
8
8
|
"Amila Welihinda (amilajack.com)",
|
9
9
|
"Bogdan Chadkin (https://github.com/TrySound)",
|
10
10
|
"Brian Woodward (https://twitter.com/doowb)",
|
11
|
-
"Charlike Mike Reagent (https://i.am.charlike.online)",
|
12
11
|
"Elan Shanker (https://github.com/es128)",
|
13
|
-
"Fabrício Matté (
|
12
|
+
"Fabrício Matté (https://ultcombo.js.org)",
|
14
13
|
"Jon Schlinkert (http://twitter.com/jonschlinkert)",
|
15
14
|
"Martin Kolárik (https://kolarik.sk)",
|
16
15
|
"Paul Miller (paulmillr.com)",
|
17
16
|
"Tom Byrer (https://github.com/tomByrer)",
|
17
|
+
"tunnckoCore (https://i.am.charlike.online)",
|
18
|
+
"Tyler Akins (http://rumkin.com)",
|
18
19
|
"(https://github.com/DianeLooney)"
|
19
20
|
],
|
20
21
|
"repository": "micromatch/micromatch",
|
@@ -34,32 +35,32 @@
|
|
34
35
|
"test": "mocha"
|
35
36
|
},
|
36
37
|
"dependencies": {
|
37
|
-
"arr-diff": "^
|
38
|
+
"arr-diff": "^4.0.0",
|
38
39
|
"array-unique": "^0.3.2",
|
39
|
-
"braces": "^2.
|
40
|
-
"define-property": "^0.
|
40
|
+
"braces": "^2.2.2",
|
41
|
+
"define-property": "^1.0.0",
|
41
42
|
"extend-shallow": "^2.0.1",
|
42
|
-
"extglob": "^
|
43
|
+
"extglob": "^2.0.2",
|
43
44
|
"fragment-cache": "^0.2.1",
|
44
|
-
"kind-of": "^
|
45
|
-
"nanomatch": "^1.
|
46
|
-
"object.pick": "^1.
|
45
|
+
"kind-of": "^5.0.2",
|
46
|
+
"nanomatch": "^1.2.1",
|
47
|
+
"object.pick": "^1.3.0",
|
47
48
|
"regex-not": "^1.0.0",
|
48
49
|
"snapdragon": "^0.8.1",
|
49
50
|
"to-regex": "^3.0.1"
|
50
51
|
},
|
51
52
|
"devDependencies": {
|
52
|
-
"bash-match": "^0.2
|
53
|
+
"bash-match": "^1.0.2",
|
53
54
|
"for-own": "^1.0.0",
|
54
55
|
"gulp": "^3.9.1",
|
55
|
-
"gulp-format-md": "^0.
|
56
|
-
"gulp-istanbul": "^1.1.
|
57
|
-
"gulp-mocha": "^3.0.
|
56
|
+
"gulp-format-md": "^1.0.0",
|
57
|
+
"gulp-istanbul": "^1.1.2",
|
58
|
+
"gulp-mocha": "^3.0.1",
|
58
59
|
"gulp-unused": "^0.2.1",
|
59
60
|
"is-windows": "^1.0.1",
|
60
|
-
"minimatch": "^3.0.
|
61
|
+
"minimatch": "^3.0.4",
|
61
62
|
"minimist": "^1.2.0",
|
62
|
-
"mocha": "^3.
|
63
|
+
"mocha": "^3.5.0",
|
63
64
|
"multimatch": "^2.1.0"
|
64
65
|
},
|
65
66
|
"keywords": [
|
@@ -93,21 +94,20 @@
|
|
93
94
|
],
|
94
95
|
"lintDeps": {
|
95
96
|
"dependencies": {
|
96
|
-
"
|
97
|
-
"
|
97
|
+
"options": {
|
98
|
+
"lock": {
|
99
|
+
"snapdragon": "^0.8.1"
|
100
|
+
}
|
98
101
|
}
|
99
102
|
},
|
100
103
|
"devDependencies": {
|
101
|
-
"
|
102
|
-
"
|
103
|
-
"
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
"gulpfile.js",
|
109
|
-
"test/**/*.js"
|
110
|
-
]
|
104
|
+
"files": {
|
105
|
+
"options": {
|
106
|
+
"ignore": [
|
107
|
+
"benchmark/**"
|
108
|
+
]
|
109
|
+
}
|
110
|
+
}
|
111
111
|
}
|
112
112
|
},
|
113
113
|
"verb": {
|
@@ -135,12 +135,12 @@
|
|
135
135
|
"reflinks": true
|
136
136
|
},
|
137
137
|
"reflinks": [
|
138
|
+
"expand-brackets",
|
138
139
|
"extglob",
|
139
140
|
"glob-object",
|
140
141
|
"minimatch",
|
141
142
|
"multimatch",
|
142
|
-
"snapdragon"
|
143
|
-
"expand-brackets"
|
143
|
+
"snapdragon"
|
144
144
|
]
|
145
145
|
}
|
146
146
|
}
|