micromatch 2.3.7 → 2.3.11
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 +184 -111
- package/index.js +12 -9
- package/lib/expand.js +0 -7
- package/lib/utils.js +6 -1
- package/package.json +22 -10
package/README.md
CHANGED
@@ -1,101 +1,135 @@
|
|
1
|
-
# micromatch [](https://www.npmjs.com/package/micromatch) [](https://npmjs.org/package/micromatch) [](https://travis-ci.org/jonschlinkert/micromatch)
|
2
2
|
|
3
|
-
> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
|
3
|
+
> Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
|
4
|
+
|
5
|
+
Micromatch supports all of the same matching features as [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch).
|
6
|
+
|
7
|
+
* [mm()](#usage) is the same as [multimatch()](https://github.com/sindresorhus/multimatch)
|
8
|
+
* [mm.match()](#match) is the same as [minimatch.match()](https://github.com/isaacs/minimatch)
|
9
|
+
* use [mm.isMatch()](#ismatch) instead of [minimatch()](https://github.com/isaacs/minimatch)
|
4
10
|
|
5
11
|
## Install
|
6
12
|
|
7
|
-
Install with [npm](https://www.npmjs.com/)
|
13
|
+
Install with [npm](https://www.npmjs.com/):
|
8
14
|
|
9
15
|
```sh
|
10
|
-
$ npm
|
11
|
-
```
|
12
|
-
|
13
|
-
## Table of contents
|
14
|
-
|
15
|
-
<!-- toc -->
|
16
|
-
|
17
|
-
* [Features](#features)
|
18
|
-
* [Usage](#usage)
|
19
|
-
* [Switch from minimatch](#switch-from-minimatch)
|
20
|
-
* [Methods](#methods)
|
21
|
-
- [.isMatch](#ismatch)
|
22
|
-
- [.contains](#contains)
|
23
|
-
- [.matcher](#matcher)
|
24
|
-
- [.filter](#filter)
|
25
|
-
- [.any](#any)
|
26
|
-
- [.expand](#expand)
|
27
|
-
- [.makeRe](#makere)
|
28
|
-
* [Options](#options)
|
29
|
-
- [options.unixify](#optionsunixify)
|
30
|
-
- [options.dot](#optionsdot)
|
31
|
-
- [options.unescape](#optionsunescape)
|
32
|
-
- [options.nodupes](#optionsnodupes)
|
33
|
-
- [options.matchBase](#optionsmatchbase)
|
34
|
-
- [options.nobraces](#optionsnobraces)
|
35
|
-
- [options.nobrackets](#optionsnobrackets)
|
36
|
-
- [options.noextglob](#optionsnoextglob)
|
37
|
-
- [options.nocase](#optionsnocase)
|
38
|
-
- [options.nonull](#optionsnonull)
|
39
|
-
- [options.cache](#optionscache)
|
40
|
-
* [Other features](#other-features)
|
41
|
-
- [Extended globbing](#extended-globbing)
|
42
|
-
+ [extglobs](#extglobs)
|
43
|
-
+ [brace expansion](#brace-expansion)
|
44
|
-
+ [regex character classes](#regex-character-classes)
|
45
|
-
+ [regex groups](#regex-groups)
|
46
|
-
+ [POSIX bracket expressions](#posix-bracket-expressions)
|
47
|
-
* [Notes](#notes)
|
48
|
-
* [Benchmarks](#benchmarks)
|
49
|
-
* [Run tests](#run-tests)
|
50
|
-
* [Contributing](#contributing)
|
51
|
-
* [Related](#related)
|
52
|
-
* [Author](#author)
|
53
|
-
* [License](#license)
|
54
|
-
|
55
|
-
_(Table of contents generated by [verb](https://github.com/verbose/verb))_
|
56
|
-
|
57
|
-
<!-- tocstop -->
|
58
|
-
|
59
|
-
## Features
|
60
|
-
|
61
|
-
Micromatch is [10-55x faster](#benchmarks) than [minimatch](https://github.com/isaacs/minimatch), resulting from a combination of caching, tokenization, parsing, runtime compilation and regex optimization strategies.
|
16
|
+
$ npm install --save micromatch
|
17
|
+
```
|
62
18
|
|
63
|
-
|
64
|
-
* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']`
|
65
|
-
* Better support for the Bash 4.3 specification, and less buggy
|
66
|
-
* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests.
|
19
|
+
## Start matching!
|
67
20
|
|
68
|
-
|
21
|
+
```js
|
22
|
+
var mm = require('micromatch');
|
23
|
+
console.log(mm(['']))
|
24
|
+
```
|
25
|
+
|
26
|
+
***
|
27
|
+
|
28
|
+
### Features
|
69
29
|
|
30
|
+
* [Drop-in replacement](#switch-from-minimatch) for [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch)
|
31
|
+
* Built-in support for multiple glob patterns, like `['foo/*.js', '!bar.js']`
|
70
32
|
* [Brace Expansion](https://github.com/jonschlinkert/braces) (`foo/bar-{1..5}.md`, `one/{two,three}/four.md`)
|
71
33
|
* Typical glob patterns, like `**/*`, `a/b/*.js`, or `['foo/*.js', '!bar.js']`
|
34
|
+
* Methods like `.isMatch()`, `.contains()` and `.any()`
|
72
35
|
|
73
36
|
**Extended globbing features:**
|
74
37
|
|
75
38
|
* Logical `OR` (`foo/bar/(abc|xyz).js`)
|
76
39
|
* Regex character classes (`foo/bar/baz-[1-5].js`)
|
77
40
|
* POSIX [bracket expressions](https://github.com/jonschlinkert/expand-brackets) (`**/[[:alpha:][:digit:]]/`)
|
78
|
-
* [extglobs](https://github.com/jonschlinkert/extglob) (`**/+(x|y)`, `!(a|b)`, etc)
|
41
|
+
* [extglobs](https://github.com/jonschlinkert/extglob) (`**/+(x|y)`, `!(a|b)`, etc).
|
79
42
|
|
80
43
|
You can combine these to create whatever matching patterns you need.
|
81
44
|
|
45
|
+
**Example**
|
46
|
+
|
47
|
+
```js
|
48
|
+
// double-negation!
|
49
|
+
mm(['fa', 'fb', 'f', 'fo'], '!(f!(o))');
|
50
|
+
//=> ['fo']
|
51
|
+
```
|
52
|
+
|
53
|
+
## Why switch to micromatch?
|
54
|
+
|
55
|
+
* Native support for multiple glob patterns, no need for wrappers like [multimatch](https://github.com/sindresorhus/multimatch)
|
56
|
+
* [10-55x faster](#benchmarks) and more performant than [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch). This is achieved through a combination of caching and regex optimization strategies, a fundamentally different approach than minimatch.
|
57
|
+
* More extensive support for the Bash 4.3 specification
|
58
|
+
* More complete extglob support
|
59
|
+
* Extensive [unit tests](./test) (approx. 1,300 tests). Minimatch fails many of the tests.
|
60
|
+
|
61
|
+
### Switch from minimatch
|
62
|
+
|
63
|
+
Use `mm.isMatch()` instead of `minimatch()`:
|
64
|
+
|
65
|
+
```js
|
66
|
+
mm.isMatch('foo', 'b*');
|
67
|
+
//=> false
|
68
|
+
```
|
69
|
+
|
70
|
+
Use `mm.match()` instead of `minimatch.match()`:
|
71
|
+
|
72
|
+
```js
|
73
|
+
mm.match(['foo', 'bar'], 'b*');
|
74
|
+
//=> 'bar'
|
75
|
+
```
|
76
|
+
|
77
|
+
### Switch from multimatch
|
78
|
+
|
79
|
+
Same signature:
|
80
|
+
|
81
|
+
```js
|
82
|
+
mm(['foo', 'bar', 'baz'], ['f*', '*z']);
|
83
|
+
//=> ['foo', 'baz']
|
84
|
+
```
|
85
|
+
|
86
|
+
***
|
87
|
+
|
82
88
|
## Usage
|
83
89
|
|
90
|
+
Add micromatch to your node.js project:
|
91
|
+
|
84
92
|
```js
|
85
93
|
var mm = require('micromatch');
|
86
|
-
mm(array, patterns);
|
87
94
|
```
|
88
95
|
|
89
|
-
**
|
96
|
+
**Signature**
|
97
|
+
|
98
|
+
```js
|
99
|
+
mm(array_of_strings, glob_patterns[, options]);
|
100
|
+
```
|
101
|
+
|
102
|
+
**Example**
|
103
|
+
|
104
|
+
```js
|
105
|
+
mm(['foo', 'bar', 'baz'], 'b*');
|
106
|
+
//=> ['bar', 'baz']
|
107
|
+
```
|
108
|
+
|
109
|
+
### Usage examples
|
110
|
+
|
111
|
+
**Brace expansion**
|
112
|
+
|
113
|
+
Match files with `.js` or `.txt` extensions.
|
90
114
|
|
91
115
|
```js
|
92
116
|
mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}');
|
93
117
|
//=> ['a.js', 'c.txt']
|
94
118
|
```
|
95
119
|
|
120
|
+
**Extglobs**
|
121
|
+
|
122
|
+
Match anything except for files with the `.md` extension.
|
123
|
+
|
124
|
+
```js
|
125
|
+
mm(files, '**/*.!(md)');
|
126
|
+
|
127
|
+
//=> ['a.js', 'c.txt']
|
128
|
+
```
|
129
|
+
|
96
130
|
**Multiple patterns**
|
97
131
|
|
98
|
-
|
132
|
+
Match using an array of patterns.
|
99
133
|
|
100
134
|
```js
|
101
135
|
mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']);
|
@@ -104,10 +138,10 @@ mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']);
|
|
104
138
|
|
105
139
|
**Negation patterns:**
|
106
140
|
|
107
|
-
Behavior
|
141
|
+
Behavior is designed to be what users would expect, based on conventions that are already well-established.
|
108
142
|
|
109
|
-
*
|
110
|
-
*
|
143
|
+
* [minimatch](https://github.com/isaacs/minimatch) behavior is used when the pattern is a string, so patterns are **inclusive by default**.
|
144
|
+
* [multimatch](https://github.com/sindresorhus/multimatch) behavior is used when an array of patterns is passed, so patterns are **exclusive by default**.
|
111
145
|
|
112
146
|
```js
|
113
147
|
mm(['a.js', 'b.md', 'c.txt'], '!*.{js,txt}');
|
@@ -117,42 +151,36 @@ mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.*', '!*.{js,txt}']);
|
|
117
151
|
//=> ['a.md', 'd.json']
|
118
152
|
```
|
119
153
|
|
120
|
-
|
121
|
-
|
122
|
-
> Use `micromatch.isMatch()` instead of `minimatch()`
|
123
|
-
|
124
|
-
**Minimatch**
|
154
|
+
***
|
125
155
|
|
126
|
-
|
156
|
+
## API methods
|
127
157
|
|
128
158
|
```js
|
129
|
-
var
|
130
|
-
minimatch('foo.js', '*.js');
|
131
|
-
//=> 'true'
|
159
|
+
var mm = require('micromatch');
|
132
160
|
```
|
133
161
|
|
134
|
-
|
135
|
-
|
136
|
-
With micromatch, `.isMatch()` to get the same result:
|
162
|
+
### .match
|
137
163
|
|
138
164
|
```js
|
139
|
-
|
140
|
-
mm.isMatch('foo.js', '*.js');
|
141
|
-
//=> 'true'
|
165
|
+
mm.match(array, globString);
|
142
166
|
```
|
143
167
|
|
144
|
-
|
168
|
+
Return an array of files that match the given glob pattern. Useful if you only need to use a single glob pattern.
|
145
169
|
|
146
|
-
|
170
|
+
**Example**
|
147
171
|
|
148
172
|
```js
|
149
|
-
|
173
|
+
mm.match(['ab', 'a/b', 'bb', 'b/c'], '?b');
|
174
|
+
//=> ['ab', 'bb']
|
175
|
+
|
176
|
+
mm.match(['ab', 'a/b', 'bb', 'b/c'], '*/b');
|
177
|
+
//=> ['a/b']
|
150
178
|
```
|
151
179
|
|
152
180
|
### .isMatch
|
153
181
|
|
154
182
|
```js
|
155
|
-
mm.isMatch(filepath,
|
183
|
+
mm.isMatch(filepath, globString);
|
156
184
|
```
|
157
185
|
|
158
186
|
Returns true if a file path matches the given glob pattern.
|
@@ -419,6 +447,14 @@ Type: `{Boolean}`
|
|
419
447
|
|
420
448
|
Default: `false`
|
421
449
|
|
450
|
+
### options.nonegate
|
451
|
+
|
452
|
+
Disallow negation (`!`) patterns.
|
453
|
+
|
454
|
+
Type: `{Boolean}`
|
455
|
+
|
456
|
+
Default: `false`
|
457
|
+
|
422
458
|
### options.nonull
|
423
459
|
|
424
460
|
If `true`, when no matches are found the actual (array-ified) glob pattern is returned instead of an empty array. Same behavior as [minimatch](https://github.com/isaacs/minimatch).
|
@@ -435,6 +471,8 @@ Type: `{Boolean}`
|
|
435
471
|
|
436
472
|
Default: `true`
|
437
473
|
|
474
|
+
***
|
475
|
+
|
438
476
|
## Other features
|
439
477
|
|
440
478
|
Micromatch also supports the following.
|
@@ -445,13 +483,13 @@ Micromatch also supports the following.
|
|
445
483
|
|
446
484
|
Extended globbing, as described by the bash man page:
|
447
485
|
|
448
|
-
| **pattern** | **regex equivalent** | **description** |
|
486
|
+
| **pattern** | **regex equivalent** | **description** |
|
449
487
|
| --- | --- | --- |
|
450
|
-
| `?(pattern-list)` | `(
|
451
|
-
| `*(pattern-list)` | `(
|
452
|
-
| `+(pattern-list)` | `(
|
453
|
-
| `@(pattern-list)` | `(
|
454
|
-
| `!(pattern-list)` | N/A |
|
488
|
+
| `?(pattern-list)` | `(... | ...)?` | Matches zero or one occurrence of the given patterns |
|
489
|
+
| `*(pattern-list)` | `(... | ...)*` | Matches zero or more occurrences of the given patterns |
|
490
|
+
| `+(pattern-list)` | `(... | ...)+` | Matches one or more occurrences of the given patterns |
|
491
|
+
| `@(pattern-list)` | `(... | ...)` <sup>*</sup> | Matches one of the given patterns |
|
492
|
+
| `!(pattern-list)` | N/A | Matches anything except one of the given patterns |
|
455
493
|
|
456
494
|
<sup><strong>*</strong></sup> `@` isn't a RegEx character.
|
457
495
|
|
@@ -504,6 +542,8 @@ mm.isMatch('a1', '[[:alpha:][:digit:]]');
|
|
504
542
|
|
505
543
|
See [expand-brackets](https://github.com/jonschlinkert/expand-brackets) for more information about extended bracket expressions.
|
506
544
|
|
545
|
+
***
|
546
|
+
|
507
547
|
## Notes
|
508
548
|
|
509
549
|
Whenever possible parsing behavior for patterns is based on globbing specifications in Bash 4.3. Patterns that aren't described by Bash follow wildmatch spec (used by git).
|
@@ -516,7 +556,7 @@ Run the [benchmarks](./benchmark):
|
|
516
556
|
node benchmark
|
517
557
|
```
|
518
558
|
|
519
|
-
As of
|
559
|
+
As of July 15, 2016:
|
520
560
|
|
521
561
|
```bash
|
522
562
|
#1: basename-braces
|
@@ -572,45 +612,78 @@ As of October 03, 2015:
|
|
572
612
|
minimatch x 53,765 ops/sec ±0.75% (95 runs sampled)
|
573
613
|
```
|
574
614
|
|
575
|
-
##
|
615
|
+
## Tests
|
616
|
+
|
617
|
+
### Running tests
|
576
618
|
|
577
619
|
Install dev dependencies:
|
578
620
|
|
579
621
|
```sh
|
580
|
-
$ npm
|
622
|
+
$ npm install -d && npm test
|
623
|
+
```
|
624
|
+
|
625
|
+
### Coverage
|
626
|
+
|
627
|
+
As of July 15, 2016:
|
628
|
+
|
629
|
+
```sh
|
630
|
+
Statements : 100% (441/441)
|
631
|
+
Branches : 100% (270/270)
|
632
|
+
Functions : 100% (54/54)
|
633
|
+
Lines : 100% (429/429)
|
581
634
|
```
|
582
635
|
|
583
636
|
## Contributing
|
584
637
|
|
585
|
-
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](
|
638
|
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
586
639
|
|
587
640
|
Please be sure to run the benchmarks before/after any code changes to judge the impact before you do a PR. thanks!
|
588
641
|
|
589
642
|
## Related
|
590
643
|
|
591
|
-
* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete… [more](https://
|
592
|
-
* [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)
|
593
|
-
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers… [more](https://
|
594
|
-
* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the… [more](https://
|
595
|
-
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally… [more](https://
|
596
|
-
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array
|
597
|
-
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a… [more](https://
|
598
|
-
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob)
|
644
|
+
* [braces](https://www.npmjs.com/package/braces): Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces… [more](https://github.com/jonschlinkert/braces) | [homepage](https://github.com/jonschlinkert/braces "Fastest brace expansion for node.js, with the most complete support for the Bash 4.3 braces specification.")
|
645
|
+
* [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.")
|
646
|
+
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See… [more](https://github.com/jonschlinkert/expand-range) | [homepage](https://github.com/jonschlinkert/expand-range "Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. See the benchmarks. Used by micromatch.")
|
647
|
+
* [extglob](https://www.npmjs.com/package/extglob): Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to… [more](https://github.com/jonschlinkert/extglob) | [homepage](https://github.com/jonschlinkert/extglob "Convert extended globs to regex-compatible strings. Add (almost) the expressive power of regular expressions to glob patterns.")
|
648
|
+
* [fill-range](https://www.npmjs.com/package/fill-range): Fill in a range of numbers or letters, optionally passing an increment or multiplier 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 multiplier to use.")
|
649
|
+
* [gulp-micromatch](https://www.npmjs.com/package/gulp-micromatch): Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream. | [homepage](https://github.com/tunnckocore/gulp-micromatch#readme "Filter vinyl files with glob patterns, string, regexp, array, object or matcher function. micromatch stream.")
|
650
|
+
* [is-glob](https://www.npmjs.com/package/is-glob): Returns `true` if the given string looks like a glob pattern or an extglob pattern… [more](https://github.com/jonschlinkert/is-glob) | [homepage](https://github.com/jonschlinkert/is-glob "Returns `true` if the given string looks like a glob pattern or an extglob pattern. This makes it easy to create code that only uses external modules like node-glob when necessary, resulting in much faster code execution and initialization time, and a bet")
|
651
|
+
* [parse-glob](https://www.npmjs.com/package/parse-glob): Parse a glob pattern into an object of tokens. | [homepage](https://github.com/jonschlinkert/parse-glob "Parse a glob pattern into an object of tokens.")
|
652
|
+
|
653
|
+
## Contributing
|
654
|
+
|
655
|
+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
656
|
+
|
657
|
+
## Building docs
|
658
|
+
|
659
|
+
_(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
|
660
|
+
|
661
|
+
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
662
|
+
|
663
|
+
```sh
|
664
|
+
$ npm install -g verb verb-generate-readme && verb
|
665
|
+
```
|
666
|
+
|
667
|
+
## Running tests
|
668
|
+
|
669
|
+
Install dev dependencies:
|
670
|
+
|
671
|
+
```sh
|
672
|
+
$ npm install -d && npm test
|
673
|
+
```
|
599
674
|
|
600
675
|
## Author
|
601
676
|
|
602
677
|
**Jon Schlinkert**
|
603
678
|
|
604
|
-
|
605
|
-
|
679
|
+
* [github/jonschlinkert](https://github.com/jonschlinkert)
|
680
|
+
* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)
|
606
681
|
|
607
682
|
## License
|
608
683
|
|
609
|
-
Copyright ©
|
610
|
-
Released under the MIT license.
|
684
|
+
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).
|
685
|
+
Released under the [MIT license](https://github.com/jonschlinkert/micromatch/blob/master/LICENSE).
|
611
686
|
|
612
687
|
***
|
613
688
|
|
614
|
-
_This file was generated by [verb
|
615
|
-
|
616
|
-
<!-- deps:mocha browserify -->
|
689
|
+
_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on July 15, 2016._
|
package/index.js
CHANGED
@@ -47,14 +47,14 @@ function micromatch(files, patterns, opts) {
|
|
47
47
|
}
|
48
48
|
|
49
49
|
/**
|
50
|
-
*
|
50
|
+
* Return an array of files that match the given glob pattern.
|
51
51
|
*
|
52
|
-
* This function is called by the main `micromatch` function
|
53
|
-
*
|
54
|
-
*
|
52
|
+
* This function is called by the main `micromatch` function If you only
|
53
|
+
* need to pass a single pattern you might get very minor speed improvements
|
54
|
+
* using this function.
|
55
55
|
*
|
56
56
|
* @param {Array} `files`
|
57
|
-
* @param {
|
57
|
+
* @param {String} `pattern`
|
58
58
|
* @param {Object} `options`
|
59
59
|
* @return {Array}
|
60
60
|
*/
|
@@ -131,7 +131,6 @@ function match(files, pattern, opts) {
|
|
131
131
|
* ['a', 'b', 'c', 'd', 'e'].filter(fn);
|
132
132
|
* //=> ['a', 'b', 'c']
|
133
133
|
* ```
|
134
|
-
*
|
135
134
|
* @param {String|Array} `patterns` Can be a glob or array of globs.
|
136
135
|
* @param {Options} `opts` Options to pass to the [matcher] method.
|
137
136
|
* @return {Function} Filter function to be passed to `Array#filter()`.
|
@@ -177,7 +176,6 @@ function filter(patterns, opts) {
|
|
177
176
|
* isMatch('*.md', {})('foo.md')
|
178
177
|
* //=> true
|
179
178
|
* ```
|
180
|
-
*
|
181
179
|
* @param {String} `fp`
|
182
180
|
* @param {String} `pattern`
|
183
181
|
* @param {Object} `opts`
|
@@ -375,8 +373,13 @@ function wrapGlob(glob, opts) {
|
|
375
373
|
}
|
376
374
|
|
377
375
|
/**
|
378
|
-
*
|
379
|
-
* the
|
376
|
+
* Create and cache a regular expression for matching file paths.
|
377
|
+
* If the leading character in the `glob` is `!`, a negation
|
378
|
+
* regex is returned.
|
379
|
+
*
|
380
|
+
* @param {String} `glob`
|
381
|
+
* @param {Object} `options`
|
382
|
+
* @return {RegExp}
|
380
383
|
*/
|
381
384
|
|
382
385
|
function makeRe(glob, opts) {
|
package/lib/expand.js
CHANGED
@@ -138,13 +138,6 @@ function expand(pattern, options) {
|
|
138
138
|
glob.pattern = globstar(opts.dot);
|
139
139
|
|
140
140
|
} else {
|
141
|
-
// '/*/*/*' => '(?:/*){3}'
|
142
|
-
glob._replace(/(\/\*)+/g, function(match) {
|
143
|
-
var len = match.length / 2;
|
144
|
-
if (len === 1) { return match; }
|
145
|
-
return '(?:\\/*){' + len + '}';
|
146
|
-
});
|
147
|
-
|
148
141
|
glob.pattern = balance(glob.pattern, '[', ']');
|
149
142
|
glob.escape(glob.pattern);
|
150
143
|
|
package/lib/utils.js
CHANGED
@@ -43,8 +43,13 @@ utils.filename = function filename(fp) {
|
|
43
43
|
*/
|
44
44
|
|
45
45
|
utils.isPath = function isPath(pattern, opts) {
|
46
|
+
opts = opts || {};
|
46
47
|
return function(fp) {
|
47
|
-
|
48
|
+
var unixified = utils.unixify(fp, opts);
|
49
|
+
if(opts.nocase){
|
50
|
+
return pattern.toLowerCase() === unixified.toLowerCase();
|
51
|
+
}
|
52
|
+
return pattern === unixified;
|
48
53
|
};
|
49
54
|
};
|
50
55
|
|
package/package.json
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
{
|
2
2
|
"name": "micromatch",
|
3
|
-
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.
|
4
|
-
"version": "2.3.
|
3
|
+
"description": "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.",
|
4
|
+
"version": "2.3.11",
|
5
5
|
"homepage": "https://github.com/jonschlinkert/micromatch",
|
6
6
|
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
|
7
7
|
"repository": "jonschlinkert/micromatch",
|
@@ -11,7 +11,7 @@
|
|
11
11
|
"license": "MIT",
|
12
12
|
"files": [
|
13
13
|
"index.js",
|
14
|
-
"lib
|
14
|
+
"lib"
|
15
15
|
],
|
16
16
|
"main": "index.js",
|
17
17
|
"engines": {
|
@@ -40,13 +40,14 @@
|
|
40
40
|
"chalk": "^1.1.1",
|
41
41
|
"gulp": "^3.9.0",
|
42
42
|
"gulp-eslint": "^1.1.1",
|
43
|
+
"gulp-format-md": "^0.1.8",
|
43
44
|
"gulp-istanbul": "^0.10.1",
|
44
45
|
"gulp-mocha": "^2.1.3",
|
45
46
|
"minimatch": "^3.0.0",
|
46
47
|
"minimist": "^1.2.0",
|
47
|
-
"mocha": "
|
48
|
+
"mocha": "^2",
|
48
49
|
"multimatch": "^2.0.0",
|
49
|
-
"should": "
|
50
|
+
"should": "^8",
|
50
51
|
"write": "^0.2.1"
|
51
52
|
},
|
52
53
|
"keywords": [
|
@@ -81,13 +82,13 @@
|
|
81
82
|
"related": {
|
82
83
|
"list": [
|
83
84
|
"braces",
|
84
|
-
"extglob",
|
85
85
|
"expand-brackets",
|
86
|
-
"fill-range",
|
87
86
|
"expand-range",
|
87
|
+
"extglob",
|
88
|
+
"fill-range",
|
88
89
|
"gulp-micromatch",
|
89
|
-
"
|
90
|
-
"
|
90
|
+
"is-glob",
|
91
|
+
"parse-glob"
|
91
92
|
]
|
92
93
|
},
|
93
94
|
"reflinks": [
|
@@ -97,6 +98,17 @@
|
|
97
98
|
"minimatch",
|
98
99
|
"multimatch",
|
99
100
|
"verb"
|
100
|
-
]
|
101
|
+
],
|
102
|
+
"toc": false,
|
103
|
+
"layout": false,
|
104
|
+
"tasks": [
|
105
|
+
"readme"
|
106
|
+
],
|
107
|
+
"plugins": [
|
108
|
+
"gulp-format-md"
|
109
|
+
],
|
110
|
+
"lint": {
|
111
|
+
"reflinks": true
|
112
|
+
}
|
101
113
|
}
|
102
114
|
}
|