You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.
4
4
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
-
7
5
## Install
8
6
9
7
Install with [npm](https://www.npmjs.com/):
@@ -12,6 +10,12 @@ Install with [npm](https://www.npmjs.com/):
12
10
$ npm install --save extglob
13
11
```
14
12
13
+
Install with [yarn](https://yarnpkg.com):
14
+
15
+
```sh
16
+
$ yarn add extglob
17
+
```
18
+
15
19
* Convert an extglob string to a regex-compatible string.
16
20
* More complete (and correct) support than [minimatch](https://github.com/isaacs/minimatch) (minimatch fails a large percentage of the extglob tests)
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)):
Create a regular expression from the given `pattern` and `options`.
193
197
@@ -200,8 +204,8 @@ Create a regular expression from the given `pattern` and `options`.
200
204
**Example**
201
205
202
206
```js
203
-
var extglob =require('extglob');
204
-
var re =extglob.makeRe('*.!(*a)');
207
+
constextglob=require('extglob');
208
+
constre=extglob.makeRe('*.!(*a)');
205
209
console.log(re);
206
210
//=> /^[^\/]*?\.(?![^\/]*?a)[^\/]*?$/
207
211
```
@@ -240,38 +244,38 @@ Throw an error is no matches are found.
240
244
241
245
## Benchmarks
242
246
243
-
Last run on December 21, 2017
247
+
Last run on April 30, 2018
244
248
245
249
```sh
246
250
# 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)
249
253
250
-
fastest is extglob (by 1072% avg)
254
+
fastest is extglob (by 880% avg)
251
255
252
256
# 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)
255
259
256
-
fastest is extglob (by 707% avg)
260
+
fastest is extglob (by 498% avg)
257
261
258
262
# 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)
261
265
262
-
fastest is extglob (by 834% avg)
266
+
fastest is extglob (by 656% avg)
263
267
264
268
# 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)
267
271
268
-
fastest is extglob (by 806% avg)
272
+
fastest is extglob (by 634% avg)
269
273
270
274
# 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)
273
277
274
-
fastest is extglob (by 644% avg)
278
+
fastest is extglob (by 476% avg)
275
279
276
280
```
277
281
@@ -284,25 +288,31 @@ This library has complete parity with Bash 4.3 with only a couple of minor diffe
284
288
285
289
## About
286
290
287
-
<details>
288
-
<summary><strong>Contributing</strong></summary>
291
+
### Related projects
289
292
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.")
291
298
292
-
</details>
299
+
### Contributing
293
300
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).
296
302
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:
_(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.)_
308
318
@@ -312,51 +322,26 @@ To generate the readme, run the following command:
*[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
326
326
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:
2 commit comments
felixrabe commentedon May 12, 2018
Hi there. Would you please add a tag / release (GitHub) as well? Thx.
danez commentedon May 15, 2018
Done