Skip to content

Commit 0daa3ed

Browse files
committedApr 30, 2018
3.0.0
1 parent dedd109 commit 0daa3ed

File tree

5 files changed

+98
-105
lines changed

5 files changed

+98
-105
lines changed
 

‎LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2015-2017, Jon Schlinkert.
3+
Copyright (c) 2015-2018, Jon Schlinkert.
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

‎README.md

+73-88
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
# extglob [![NPM version](https://img.shields.io/npm/v/extglob.svg?style=flat)](https://www.npmjs.com/package/extglob) [![NPM monthly downloads](https://img.shields.io/npm/dm/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![NPM total downloads](https://img.shields.io/npm/dt/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![Linux Build Status](https://img.shields.io/travis/micromatch/extglob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/extglob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/extglob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/extglob)
1+
# extglob [![NPM version](https://img.shields.io/npm/v/extglob.svg?style=flat)](https://www.npmjs.com/package/extglob) [![NPM monthly downloads](https://img.shields.io/npm/dm/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![NPM total downloads](https://img.shields.io/npm/dt/extglob.svg?style=flat)](https://npmjs.org/package/extglob) [![Linux Build Status](https://img.shields.io/travis/micromatch/extglob.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/extglob) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/extglob.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/extglob)
22

33
> Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.
44
5-
Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
6-
75
## Install
86

97
Install with [npm](https://www.npmjs.com/):
@@ -12,6 +10,12 @@ Install with [npm](https://www.npmjs.com/):
1210
$ npm install --save extglob
1311
```
1412

13+
Install with [yarn](https://yarnpkg.com):
14+
15+
```sh
16+
$ yarn add extglob
17+
```
18+
1519
* Convert an extglob string to a regex-compatible string.
1620
* More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch) (minimatch fails a large percentage of the extglob tests)
1721
* Handles [negation patterns](#extglob-patterns)
@@ -34,17 +38,17 @@ console.log(extglob('!(xyz)*.js'));
3438

3539
Extended globbing patterns can be defined as follows (as described by the [bash man page](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html)):
3640

37-
| **pattern** | **regex equivalent** | **description** |
41+
| **pattern** | **regex equivalent** | **description** |
3842
| --- | --- | --- |
39-
| `?(pattern-list)` | `(...|...)?` | Matches zero or one occurrence of the given pattern(s) |
40-
| `*(pattern-list)` | `(...|...)*` | Matches zero or more occurrences of the given pattern(s) |
41-
| `+(pattern-list)` | `(...|...)+` | Matches one or more occurrences of the given pattern(s) |
42-
| `@(pattern-list)` | `(...|...)` <sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup> | Matches one of the given pattern(s) |
43-
| `!(pattern-list)` | N/A | Matches anything except one of the given pattern(s) |
43+
| `?(pattern-list)` | `(...\|...)?` | Matches zero or one occurrence of the given pattern(s) |
44+
| `*(pattern-list)` | `(...\|...)*` | Matches zero or more occurrences of the given pattern(s) |
45+
| `+(pattern-list)` | `(...\|...)+` | Matches one or more occurrences of the given pattern(s) |
46+
| `@(pattern-list)` | `(...\|...)` [^1] | Matches one of the given pattern(s) |
47+
| `!(pattern-list)` | N/A | Matches anything except one of the given pattern(s) |
4448

4549
## API
4650

47-
### [extglob](index.js#L36)
51+
### [extglob](index.js#L35)
4852

4953
Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST.
5054

@@ -57,12 +61,12 @@ Convert the given `extglob` pattern into a regex-compatible string. Returns an o
5761
**Example**
5862

5963
```js
60-
var extglob = require('extglob');
64+
const extglob = require('extglob');
6165
console.log(extglob('*.!(*a)'));
6266
//=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
6367
```
6468

65-
### [.match](index.js#L56)
69+
### [.match](index.js#L55)
6670

6771
Takes an array of strings and an extglob pattern and returns a new array that contains only the strings that match the pattern.
6872

@@ -76,12 +80,12 @@ Takes an array of strings and an extglob pattern and returns a new array that co
7680
**Example**
7781

7882
```js
79-
var extglob = require('extglob');
83+
const extglob = require('extglob');
8084
console.log(extglob.match(['a.a', 'a.b', 'a.c'], '*.!(*a)'));
8185
//=> ['a.b', 'a.c']
8286
```
8387

84-
### [.isMatch](index.js#L111)
88+
### [.isMatch](index.js#L110)
8589

8690
Returns true if the specified `string` matches the given extglob `pattern`.
8791

@@ -95,15 +99,15 @@ Returns true if the specified `string` matches the given extglob `pattern`.
9599
**Example**
96100

97101
```js
98-
var extglob = require('extglob');
102+
const extglob = require('extglob');
99103

100104
console.log(extglob.isMatch('a.a', '*.!(*a)'));
101105
//=> false
102106
console.log(extglob.isMatch('a.b', '*.!(*a)'));
103107
//=> true
104108
```
105109

106-
### [.contains](index.js#L150)
110+
### [.contains](index.js#L149)
107111

108112
Returns true if the given `string` contains the given pattern. Similar to `.isMatch` but the pattern can match any part of the string.
109113

@@ -117,14 +121,14 @@ Returns true if the given `string` contains the given pattern. Similar to `.isMa
117121
**Example**
118122

119123
```js
120-
var extglob = require('extglob');
124+
const extglob = require('extglob');
121125
console.log(extglob.contains('aa/bb/cc', '*b'));
122126
//=> true
123127
console.log(extglob.contains('aa/bb/cc', '*d'));
124128
//=> false
125129
```
126130

127-
### [.matcher](index.js#L184)
131+
### [.matcher](index.js#L183)
128132

129133
Takes an extglob pattern and returns a matcher function. The returned function takes the string to match as its only argument.
130134

@@ -137,16 +141,16 @@ Takes an extglob pattern and returns a matcher function. The returned function t
137141
**Example**
138142

139143
```js
140-
var extglob = require('extglob');
141-
var isMatch = extglob.matcher('*.!(*a)');
144+
const extglob = require('extglob');
145+
const isMatch = extglob.matcher('*.!(*a)');
142146

143147
console.log(isMatch('a.a'));
144148
//=> false
145149
console.log(isMatch('a.b'));
146150
//=> true
147151
```
148152

149-
### [.create](index.js#L214)
153+
### [.create](index.js#L213)
150154

151155
Convert the given `extglob` pattern into a regex-compatible string. Returns an object with the compiled result and the parsed AST.
152156

@@ -159,12 +163,12 @@ Convert the given `extglob` pattern into a regex-compatible string. Returns an o
159163
**Example**
160164

161165
```js
162-
var extglob = require('extglob');
166+
const extglob = require('extglob');
163167
console.log(extglob.create('*.!(*a)').output);
164168
//=> '(?!\\.)[^/]*?\\.(?!(?!\\.)[^/]*?a\\b).*?'
165169
```
166170

167-
### [.capture](index.js#L248)
171+
### [.capture](index.js#L247)
168172

169173
Returns an array of matches captured by `pattern` in `string`, or `null` if the pattern did not match.
170174

@@ -178,7 +182,7 @@ Returns an array of matches captured by `pattern` in `string`, or `null` if the
178182
**Example**
179183

180184
```js
181-
var extglob = require('extglob');
185+
const extglob = require('extglob');
182186
extglob.capture(pattern, string[, options]);
183187

184188
console.log(extglob.capture('test/*.js', 'test/foo.js'));
@@ -187,7 +191,7 @@ console.log(extglob.capture('test/*.js', 'foo/bar.css'));
187191
//=> null
188192
```
189193

190-
### [.makeRe](index.js#L281)
194+
### [.makeRe](index.js#L280)
191195

192196
Create a regular expression from the given `pattern` and `options`.
193197

@@ -200,8 +204,8 @@ Create a regular expression from the given `pattern` and `options`.
200204
**Example**
201205

202206
```js
203-
var extglob = require('extglob');
204-
var re = extglob.makeRe('*.!(*a)');
207+
const extglob = require('extglob');
208+
const re = extglob.makeRe('*.!(*a)');
205209
console.log(re);
206210
//=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/
207211
```
@@ -240,38 +244,38 @@ Throw an error is no matches are found.
240244

241245
## Benchmarks
242246

243-
Last run on December 21, 2017
247+
Last run on April 30, 2018
244248

245249
```sh
246250
# negation-nested (49 bytes)
247-
extglob x 2,228,255 ops/sec ±0.98% (89 runs sampled)
248-
minimatch x 207,875 ops/sec ±0.61% (91 runs sampled)
251+
extglob x 1,380,148 ops/sec ±3.35% (62 runs sampled)
252+
minimatch x 156,800 ops/sec ±4.13% (76 runs sampled)
249253

250-
fastest is extglob (by 1072% avg)
254+
fastest is extglob (by 880% avg)
251255

252256
# negation-simple (43 bytes)
253-
extglob x 2,205,668 ops/sec ±1.00% (91 runs sampled)
254-
minimatch x 311,923 ops/sec ±1.25% (91 runs sampled)
257+
extglob x 1,821,746 ops/sec ±1.61% (76 runs sampled)
258+
minimatch x 365,618 ops/sec ±1.87% (84 runs sampled)
255259

256-
fastest is extglob (by 707% avg)
260+
fastest is extglob (by 498% avg)
257261

258262
# range-false (57 bytes)
259-
extglob x 2,263,877 ops/sec ±0.40% (94 runs sampled)
260-
minimatch x 271,372 ops/sec ±1.02% (91 runs sampled)
263+
extglob x 2,038,592 ops/sec ±3.39% (85 runs sampled)
264+
minimatch x 310,897 ops/sec ±12.62% (87 runs sampled)
261265

262-
fastest is extglob (by 834% avg)
266+
fastest is extglob (by 656% avg)
263267

264268
# range-true (56 bytes)
265-
extglob x 2,161,891 ops/sec ±0.41% (92 runs sampled)
266-
minimatch x 268,265 ops/sec ±1.17% (91 runs sampled)
269+
extglob x 2,105,081 ops/sec ±0.69% (91 runs sampled)
270+
minimatch x 332,188 ops/sec ±0.45% (91 runs sampled)
267271

268-
fastest is extglob (by 806% avg)
272+
fastest is extglob (by 634% avg)
269273

270274
# star-simple (46 bytes)
271-
extglob x 2,211,081 ops/sec ±0.49% (92 runs sampled)
272-
minimatch x 343,319 ops/sec ±0.59% (91 runs sampled)
275+
extglob x 2,154,184 ops/sec ±0.99% (89 runs sampled)
276+
minimatch x 452,812 ops/sec ±0.51% (88 runs sampled)
273277

274-
fastest is extglob (by 644% avg)
278+
fastest is extglob (by 476% avg)
275279

276280
```
277281

@@ -284,25 +288,31 @@ This library has complete parity with Bash 4.3 with only a couple of minor diffe
284288

285289
## About
286290

287-
<details>
288-
<summary><strong>Contributing</strong></summary>
291+
### Related projects
289292

290-
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
293+
* [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.")
294+
* [expand-brackets](https://www.npmjs.com/package/expand-brackets): Expand POSIX bracket expressions (character classes) in glob patterns. | [homepage](https://github.com/micromatch/expand-brackets "Expand POSIX bracket expressions (character classes) in glob patterns.")
295+
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [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. Used by [micromatch].")
296+
* [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`")
297+
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
291298

292-
</details>
299+
### Contributing
293300

294-
<details>
295-
<summary><strong>Running Tests</strong></summary>
301+
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
296302

297-
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
303+
### Contributors
298304

299-
```sh
300-
$ npm install && npm test
301-
```
305+
| **Commits** | **Contributor** |
306+
| --- | --- |
307+
| 54 | [jonschlinkert](https://github.com/jonschlinkert) |
308+
| 6 | [danez](https://github.com/danez) |
309+
| 2 | [isiahmeadows](https://github.com/isiahmeadows) |
310+
| 1 | [doowb](https://github.com/doowb) |
311+
| 1 | [devongovett](https://github.com/devongovett) |
312+
| 1 | [mjbvz](https://github.com/mjbvz) |
313+
| 1 | [shinnn](https://github.com/shinnn) |
302314

303-
</details>
304-
<details>
305-
<summary><strong>Building docs</strong></summary>
315+
### Building docs
306316

307317
_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_
308318

@@ -312,51 +322,26 @@ To generate the readme, run the following command:
312322
$ npm install -g verbose/verb#dev verb-generate-readme && verb
313323
```
314324

315-
</details>
316-
317-
### Related projects
318-
319-
You might also be interested in these projects:
320-
321-
* [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.")
322-
* [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.")
323-
* [expand-range](https://www.npmjs.com/package/expand-range): Fast, bash-like range expansion. Expand a range of numbers or letters, uppercase or lowercase. Used… [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. Used by [micromatch].")
324-
* [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`")
325-
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
325+
### Running tests
326326

327-
### Contributors
327+
Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:
328328

329-
| **Commits** | **Contributor** |
330-
| --- | --- |
331-
| 49 | [jonschlinkert](https://github.com/jonschlinkert) |
332-
| 2 | [isiahmeadows](https://github.com/isiahmeadows) |
333-
| 1 | [doowb](https://github.com/doowb) |
334-
| 1 | [devongovett](https://github.com/devongovett) |
335-
| 1 | [mjbvz](https://github.com/mjbvz) |
336-
| 1 | [shinnn](https://github.com/shinnn) |
329+
```sh
330+
$ npm install && npm test
331+
```
337332

338333
### Author
339334

340335
**Jon Schlinkert**
341336

342-
* [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
343337
* [github/jonschlinkert](https://github.com/jonschlinkert)
344338
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
345339

346340
### License
347341

348-
Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
342+
Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
349343
Released under the [MIT License](LICENSE).
350344

351345
***
352346

353-
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on December 21, 2017._
354-
355-
<hr class="footnotes-sep">
356-
<section class="footnotes">
357-
<ol class="footnotes-list">
358-
<li id="fn1" class="footnote-item">`@` isn "'t a RegEx character." <a href="#fnref1" class="footnote-backref">↩</a>
359-
360-
</li>
361-
</ol>
362-
</section>
347+
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on April 30, 2018._

‎benchmark/stats.md

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# negation-nested (49 bytes)
2-
extglob x 2,228,255 ops/sec ±0.98% (89 runs sampled)
3-
minimatch x 207,875 ops/sec ±0.61% (91 runs sampled)
2+
extglob x 1,380,148 ops/sec ±3.35% (62 runs sampled)
3+
minimatch x 156,800 ops/sec ±4.13% (76 runs sampled)
44

5-
fastest is extglob (by 1072% avg)
5+
fastest is extglob (by 880% avg)
66

77
# negation-simple (43 bytes)
8-
extglob x 2,205,668 ops/sec ±1.00% (91 runs sampled)
9-
minimatch x 311,923 ops/sec ±1.25% (91 runs sampled)
8+
extglob x 1,821,746 ops/sec ±1.61% (76 runs sampled)
9+
minimatch x 365,618 ops/sec ±1.87% (84 runs sampled)
1010

11-
fastest is extglob (by 707% avg)
11+
fastest is extglob (by 498% avg)
1212

1313
# range-false (57 bytes)
14-
extglob x 2,263,877 ops/sec ±0.40% (94 runs sampled)
15-
minimatch x 271,372 ops/sec ±1.02% (91 runs sampled)
14+
extglob x 2,038,592 ops/sec ±3.39% (85 runs sampled)
15+
minimatch x 310,897 ops/sec ±12.62% (87 runs sampled)
1616

17-
fastest is extglob (by 834% avg)
17+
fastest is extglob (by 656% avg)
1818

1919
# range-true (56 bytes)
20-
extglob x 2,161,891 ops/sec ±0.41% (92 runs sampled)
21-
minimatch x 268,265 ops/sec ±1.17% (91 runs sampled)
20+
extglob x 2,105,081 ops/sec ±0.69% (91 runs sampled)
21+
minimatch x 332,188 ops/sec ±0.45% (91 runs sampled)
2222

23-
fastest is extglob (by 806% avg)
23+
fastest is extglob (by 634% avg)
2424

2525
# star-simple (46 bytes)
26-
extglob x 2,211,081 ops/sec ±0.49% (92 runs sampled)
27-
minimatch x 343,319 ops/sec ±0.59% (91 runs sampled)
26+
extglob x 2,154,184 ops/sec ±0.99% (89 runs sampled)
27+
minimatch x 452,812 ops/sec ±0.51% (88 runs sampled)
2828

29-
fastest is extglob (by 644% avg)
29+
fastest is extglob (by 476% avg)

‎changelog.md

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
## Changelog
22

3+
### v3.0.0
4+
5+
**Breaking changes**
6+
7+
- Snapdragon was updated to 0.12. Other packages that integrate `extglob` need to also use snapdragon 0.12.
8+
- Minimum Node.JS version is now version 4.
9+
10+
311
### v2.0.0
412

513
**Added features**

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "extglob",
33
"description": "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.",
4-
"version": "2.0.4",
4+
"version": "3.0.0",
55
"homepage": "https://github.com/micromatch/extglob",
66
"author": "Jon Schlinkert (https://github.com/jonschlinkert)",
77
"contributors": [

2 commit comments

Comments
 (2)

felixrabe commented on May 12, 2018

@felixrabe

Hi there. Would you please add a tag / release (GitHub) as well? Thx.

danez commented on May 15, 2018

@danez
MemberAuthor

Done

Please sign in to comment.