source: imaps-frontend/node_modules/picomatch/README.md

main
Last change on this file was 0c6b92a, checked in by stefan toskovski <stefantoska84@…>, 5 weeks ago

Pred finalna verzija

  • Property mode set to 100644
File size: 26.8 KB
RevLine 
[0c6b92a]1<h1 align="center">Picomatch</h1>
2
3<p align="center">
4<a href="https://npmjs.org/package/picomatch">
5<img src="https://img.shields.io/npm/v/picomatch.svg" alt="version">
6</a>
7<a href="https://github.com/micromatch/picomatch/actions?workflow=Tests">
8<img src="https://github.com/micromatch/picomatch/workflows/Tests/badge.svg" alt="test status">
9</a>
10<a href="https://coveralls.io/github/micromatch/picomatch">
11<img src="https://img.shields.io/coveralls/github/micromatch/picomatch/master.svg" alt="coverage status">
12</a>
13<a href="https://npmjs.org/package/picomatch">
14<img src="https://img.shields.io/npm/dm/picomatch.svg" alt="downloads">
15</a>
16</p>
17
18<br>
19<br>
20
21<p align="center">
22<strong>Blazing fast and accurate glob matcher written in JavaScript.</strong></br>
23<em>No dependencies and full support for standard and extended Bash glob features, including braces, extglobs, POSIX brackets, and regular expressions.</em>
24</p>
25
26<br>
27<br>
28
29## Why picomatch?
30
31* **Lightweight** - No dependencies
32* **Minimal** - Tiny API surface. Main export is a function that takes a glob pattern and returns a matcher function.
33* **Fast** - Loads in about 2ms (that's several times faster than a [single frame of a HD movie](http://www.endmemo.com/sconvert/framespersecondframespermillisecond.php) at 60fps)
34* **Performant** - Use the returned matcher function to speed up repeat matching (like when watching files)
35* **Accurate matching** - Using wildcards (`*` and `?`), globstars (`**`) for nested directories, [advanced globbing](#advanced-globbing) with extglobs, braces, and POSIX brackets, and support for escaping special characters with `\` or quotes.
36* **Well tested** - Thousands of unit tests
37
38See the [library comparison](#library-comparisons) to other libraries.
39
40<br>
41<br>
42
43## Table of Contents
44
45<details><summary> Click to expand </summary>
46
47- [Install](#install)
48- [Usage](#usage)
49- [API](#api)
50 * [picomatch](#picomatch)
51 * [.test](#test)
52 * [.matchBase](#matchbase)
53 * [.isMatch](#ismatch)
54 * [.parse](#parse)
55 * [.scan](#scan)
56 * [.compileRe](#compilere)
57 * [.makeRe](#makere)
58 * [.toRegex](#toregex)
59- [Options](#options)
60 * [Picomatch options](#picomatch-options)
61 * [Scan Options](#scan-options)
62 * [Options Examples](#options-examples)
63- [Globbing features](#globbing-features)
64 * [Basic globbing](#basic-globbing)
65 * [Advanced globbing](#advanced-globbing)
66 * [Braces](#braces)
67 * [Matching special characters as literals](#matching-special-characters-as-literals)
68- [Library Comparisons](#library-comparisons)
69- [Benchmarks](#benchmarks)
70- [Philosophies](#philosophies)
71- [About](#about)
72 * [Author](#author)
73 * [License](#license)
74
75_(TOC generated by [verb](https://github.com/verbose/verb) using [markdown-toc](https://github.com/jonschlinkert/markdown-toc))_
76
77</details>
78
79<br>
80<br>
81
82## Install
83
84Install with [npm](https://www.npmjs.com/):
85
86```sh
87npm install --save picomatch
88```
89
90<br>
91
92## Usage
93
94The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.
95
96```js
97const pm = require('picomatch');
98const isMatch = pm('*.js');
99
100console.log(isMatch('abcd')); //=> false
101console.log(isMatch('a.js')); //=> true
102console.log(isMatch('a.md')); //=> false
103console.log(isMatch('a/b.js')); //=> false
104```
105
106<br>
107
108## API
109
110### [picomatch](lib/picomatch.js#L32)
111
112Creates a matcher function from one or more glob patterns. The returned function takes a string to match as its first argument, and returns true if the string is a match. The returned matcher function also takes a boolean as the second argument that, when true, returns an object with additional information.
113
114**Params**
115
116* `globs` **{String|Array}**: One or more glob patterns.
117* `options` **{Object=}**
118* `returns` **{Function=}**: Returns a matcher function.
119
120**Example**
121
122```js
123const picomatch = require('picomatch');
124// picomatch(glob[, options]);
125
126const isMatch = picomatch('*.!(*a)');
127console.log(isMatch('a.a')); //=> false
128console.log(isMatch('a.b')); //=> true
129```
130
131### [.test](lib/picomatch.js#L117)
132
133Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.
134
135**Params**
136
137* `input` **{String}**: String to test.
138* `regex` **{RegExp}**
139* `returns` **{Object}**: Returns an object with matching info.
140
141**Example**
142
143```js
144const picomatch = require('picomatch');
145// picomatch.test(input, regex[, options]);
146
147console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));
148// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }
149```
150
151### [.matchBase](lib/picomatch.js#L161)
152
153Match the basename of a filepath.
154
155**Params**
156
157* `input` **{String}**: String to test.
158* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).
159* `returns` **{Boolean}**
160
161**Example**
162
163```js
164const picomatch = require('picomatch');
165// picomatch.matchBase(input, glob[, options]);
166console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true
167```
168
169### [.isMatch](lib/picomatch.js#L183)
170
171Returns true if **any** of the given glob `patterns` match the specified `string`.
172
173**Params**
174
175* **{String|Array}**: str The string to test.
176* **{String|Array}**: patterns One or more glob patterns to use for matching.
177* **{Object}**: See available [options](#options).
178* `returns` **{Boolean}**: Returns true if any patterns match `str`
179
180**Example**
181
182```js
183const picomatch = require('picomatch');
184// picomatch.isMatch(string, patterns[, options]);
185
186console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true
187console.log(picomatch.isMatch('a.a', 'b.*')); //=> false
188```
189
190### [.parse](lib/picomatch.js#L199)
191
192Parse a glob pattern to create the source string for a regular expression.
193
194**Params**
195
196* `pattern` **{String}**
197* `options` **{Object}**
198* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.
199
200**Example**
201
202```js
203const picomatch = require('picomatch');
204const result = picomatch.parse(pattern[, options]);
205```
206
207### [.scan](lib/picomatch.js#L231)
208
209Scan a glob pattern to separate the pattern into segments.
210
211**Params**
212
213* `input` **{String}**: Glob pattern to scan.
214* `options` **{Object}**
215* `returns` **{Object}**: Returns an object with
216
217**Example**
218
219```js
220const picomatch = require('picomatch');
221// picomatch.scan(input[, options]);
222
223const result = picomatch.scan('!./foo/*.js');
224console.log(result);
225{ prefix: '!./',
226 input: '!./foo/*.js',
227 start: 3,
228 base: 'foo',
229 glob: '*.js',
230 isBrace: false,
231 isBracket: false,
232 isGlob: true,
233 isExtglob: false,
234 isGlobstar: false,
235 negated: true }
236```
237
238### [.compileRe](lib/picomatch.js#L245)
239
240Compile a regular expression from the `state` object returned by the
241[parse()](#parse) method.
242
243**Params**
244
245* `state` **{Object}**
246* `options` **{Object}**
247* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser.
248* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.
249* `returns` **{RegExp}**
250
251### [.makeRe](lib/picomatch.js#L286)
252
253Create a regular expression from a parsed glob pattern.
254
255**Params**
256
257* `state` **{String}**: The object returned from the `.parse` method.
258* `options` **{Object}**
259* `returnOutput` **{Boolean}**: Implementors may use this argument to return the compiled output, instead of a regular expression. This is not exposed on the options to prevent end-users from mutating the result.
260* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression.
261* `returns` **{RegExp}**: Returns a regex created from the given pattern.
262
263**Example**
264
265```js
266const picomatch = require('picomatch');
267const state = picomatch.parse('*.js');
268// picomatch.compileRe(state[, options]);
269
270console.log(picomatch.compileRe(state));
271//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
272```
273
274### [.toRegex](lib/picomatch.js#L321)
275
276Create a regular expression from the given regex source string.
277
278**Params**
279
280* `source` **{String}**: Regular expression source string.
281* `options` **{Object}**
282* `returns` **{RegExp}**
283
284**Example**
285
286```js
287const picomatch = require('picomatch');
288// picomatch.toRegex(source[, options]);
289
290const { output } = picomatch.parse('*.js');
291console.log(picomatch.toRegex(output));
292//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/
293```
294
295<br>
296
297## Options
298
299### Picomatch options
300
301The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.
302
303| **Option** | **Type** | **Default value** | **Description** |
304| --- | --- | --- | --- |
305| `basename` | `boolean` | `false` | If set, then patterns without slashes will be matched against the basename of the path if it contains slashes. For example, `a?b` would match the path `/xyz/123/acb`, but not `/xyz/acb/123`. |
306| `bash` | `boolean` | `false` | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |
307| `capture` | `boolean` | `undefined` | Return regex matches in supporting methods. |
308| `contains` | `boolean` | `undefined` | Allows glob to match any part of the given string(s). |
309| `cwd` | `string` | `process.cwd()` | Current working directory. Used by `picomatch.split()` |
310| `debug` | `boolean` | `undefined` | Debug regular expressions when an error is thrown. |
311| `dot` | `boolean` | `false` | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |
312| `expandRange` | `function` | `undefined` | Custom function for expanding ranges in brace patterns, such as `{a..z}`. The function receives the range values as two arguments, and it must return a string to be used in the generated regex. It's recommended that returned strings be wrapped in parentheses. |
313| `failglob` | `boolean` | `false` | Throws an error if no matches are found. Based on the bash option of the same name. |
314| `fastpaths` | `boolean` | `true` | To speed up processing, full parsing is skipped for a handful common glob patterns. Disable this behavior by setting this option to `false`. |
315| `flags` | `string` | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |
316| [format](#optionsformat) | `function` | `undefined` | Custom function for formatting the returned string. This is useful for removing leading slashes, converting Windows paths to Posix paths, etc. |
317| `ignore` | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |
318| `keepQuotes` | `boolean` | `false` | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes. |
319| `literalBrackets` | `boolean` | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |
320| `matchBase` | `boolean` | `false` | Alias for `basename` |
321| `maxLength` | `boolean` | `65536` | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |
322| `nobrace` | `boolean` | `false` | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |
323| `nobracket` | `boolean` | `undefined` | Disable matching with regex brackets. |
324| `nocase` | `boolean` | `false` | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |
325| `nodupes` | `boolean` | `true` | Deprecated, use `nounique` instead. This option will be removed in a future major release. By default duplicates are removed. Disable uniquification by setting this option to false. |
326| `noext` | `boolean` | `false` | Alias for `noextglob` |
327| `noextglob` | `boolean` | `false` | Disable support for matching with extglobs (like `+(a\|b)`) |
328| `noglobstar` | `boolean` | `false` | Disable support for matching nested directories with globstars (`**`) |
329| `nonegate` | `boolean` | `false` | Disable support for negating with leading `!` |
330| `noquantifiers` | `boolean` | `false` | Disable support for regex quantifiers (like `a{1,2}`) and treat them as brace patterns to be expanded. |
331| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |
332| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |
333| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |
334| `posix` | `boolean` | `false` | Support POSIX character classes ("posix brackets"). |
335| `posixSlashes` | `boolean` | `undefined` | Convert all slashes in file paths to forward slashes. This does not convert slashes in the glob pattern itself |
336| `prepend` | `boolean` | `undefined` | String to prepend to the generated regex used for matching. |
337| `regex` | `boolean` | `false` | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |
338| `strictBrackets` | `boolean` | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |
339| `strictSlashes` | `boolean` | `undefined` | When true, picomatch won't match trailing slashes with single stars. |
340| `unescape` | `boolean` | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |
341| `unixify` | `boolean` | `undefined` | Alias for `posixSlashes`, for backwards compatibility. |
342
343picomatch has automatic detection for regex positive and negative lookbehinds. If the pattern contains a negative lookbehind, you must be using Node.js >= 8.10 or else picomatch will throw an error.
344
345### Scan Options
346
347In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.
348
349| **Option** | **Type** | **Default value** | **Description** |
350| --- | --- | --- | --- |
351| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |
352| `parts` | `boolean` | `false` | When `true`, the returned object will include an array of strings representing each path "segment" in the scanned glob pattern. This is automatically enabled when `options.tokens` is true |
353
354**Example**
355
356```js
357const picomatch = require('picomatch');
358const result = picomatch.scan('!./foo/*.js', { tokens: true });
359console.log(result);
360// {
361// prefix: '!./',
362// input: '!./foo/*.js',
363// start: 3,
364// base: 'foo',
365// glob: '*.js',
366// isBrace: false,
367// isBracket: false,
368// isGlob: true,
369// isExtglob: false,
370// isGlobstar: false,
371// negated: true,
372// maxDepth: 2,
373// tokens: [
374// { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },
375// { value: 'foo', depth: 1, isGlob: false },
376// { value: '*.js', depth: 1, isGlob: true }
377// ],
378// slashes: [ 2, 6 ],
379// parts: [ 'foo', '*.js' ]
380// }
381```
382
383<br>
384
385### Options Examples
386
387#### options.expandRange
388
389**Type**: `function`
390
391**Default**: `undefined`
392
393Custom function for expanding ranges in brace patterns. The [fill-range](https://github.com/jonschlinkert/fill-range) library is ideal for this purpose, or you can use custom code to do whatever you need.
394
395**Example**
396
397The following example shows how to create a glob that matches a folder
398
399```js
400const fill = require('fill-range');
401const regex = pm.makeRe('foo/{01..25}/bar', {
402 expandRange(a, b) {
403 return `(${fill(a, b, { toRegex: true })})`;
404 }
405});
406
407console.log(regex);
408//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/
409
410console.log(regex.test('foo/00/bar')) // false
411console.log(regex.test('foo/01/bar')) // true
412console.log(regex.test('foo/10/bar')) // true
413console.log(regex.test('foo/22/bar')) // true
414console.log(regex.test('foo/25/bar')) // true
415console.log(regex.test('foo/26/bar')) // false
416```
417
418#### options.format
419
420**Type**: `function`
421
422**Default**: `undefined`
423
424Custom function for formatting strings before they're matched.
425
426**Example**
427
428```js
429// strip leading './' from strings
430const format = str => str.replace(/^\.\//, '');
431const isMatch = picomatch('foo/*.js', { format });
432console.log(isMatch('./foo/bar.js')); //=> true
433```
434
435#### options.onMatch
436
437```js
438const onMatch = ({ glob, regex, input, output }) => {
439 console.log({ glob, regex, input, output });
440};
441
442const isMatch = picomatch('*', { onMatch });
443isMatch('foo');
444isMatch('bar');
445isMatch('baz');
446```
447
448#### options.onIgnore
449
450```js
451const onIgnore = ({ glob, regex, input, output }) => {
452 console.log({ glob, regex, input, output });
453};
454
455const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });
456isMatch('foo');
457isMatch('bar');
458isMatch('baz');
459```
460
461#### options.onResult
462
463```js
464const onResult = ({ glob, regex, input, output }) => {
465 console.log({ glob, regex, input, output });
466};
467
468const isMatch = picomatch('*', { onResult, ignore: 'f*' });
469isMatch('foo');
470isMatch('bar');
471isMatch('baz');
472```
473
474<br>
475<br>
476
477## Globbing features
478
479* [Basic globbing](#basic-globbing) (Wildcard matching)
480* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)
481
482### Basic globbing
483
484| **Character** | **Description** |
485| --- | --- |
486| `*` | Matches any character zero or more times, excluding path separators. Does _not match_ path separators or hidden files or directories ("dotfiles"), unless explicitly enabled by setting the `dot` option to `true`. |
487| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` on Windows) when they are the only characters in a path segment. Thus, `foo**/bar` is equivalent to `foo*/bar`, and `foo/a**b/bar` is equivalent to `foo/a*b/bar`, and _more than two_ consecutive stars in a glob path segment are regarded as _a single star_. Thus, `foo/***/bar` is equivalent to `foo/*/bar`. |
488| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots. |
489| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |
490
491#### Matching behavior vs. Bash
492
493Picomatch's matching features and expected results in unit tests are based on Bash's unit tests and the Bash 4.3 specification, with the following exceptions:
494
495* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.
496* Bash greedily matches with negated extglobs. For example, Bash 4.3 says that `!(foo)*` should match `foo` and `foobar`, since the trailing `*` bracktracks to match the preceding pattern. This is very memory-inefficient, and IMHO, also incorrect. Picomatch would return `false` for both `foo` and `foobar`.
497
498<br>
499
500### Advanced globbing
501
502* [extglobs](#extglobs)
503* [POSIX brackets](#posix-brackets)
504* [Braces](#brace-expansion)
505
506#### Extglobs
507
508| **Pattern** | **Description** |
509| --- | --- |
510| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |
511| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |
512| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |
513| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |
514| `!(pattern)` | Match _anything but_ `pattern` |
515
516**Examples**
517
518```js
519const pm = require('picomatch');
520
521// *(pattern) matches ZERO or more of "pattern"
522console.log(pm.isMatch('a', 'a*(z)')); // true
523console.log(pm.isMatch('az', 'a*(z)')); // true
524console.log(pm.isMatch('azzz', 'a*(z)')); // true
525
526// +(pattern) matches ONE or more of "pattern"
527console.log(pm.isMatch('a', 'a*(z)')); // true
528console.log(pm.isMatch('az', 'a*(z)')); // true
529console.log(pm.isMatch('azzz', 'a*(z)')); // true
530
531// supports multiple extglobs
532console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false
533
534// supports nested extglobs
535console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true
536```
537
538#### POSIX brackets
539
540POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.
541
542**Enable POSIX bracket support**
543
544```js
545console.log(pm.makeRe('[[:word:]]+', { posix: true }));
546//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/
547```
548
549**Supported POSIX classes**
550
551The following named POSIX bracket expressions are supported:
552
553* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`
554* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.
555* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.
556* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.
557* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.
558* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.
559* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.
560* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.
561* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.
562* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.
563* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.
564* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.
565* `[:word:]` - Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.
566* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.
567
568See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.
569
570### Braces
571
572Picomatch does not do brace expansion. For [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) and advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch) instead. Picomatch has very basic support for braces.
573
574### Matching special characters as literals
575
576If you wish to match the following special characters in a filepath, and you want to use these characters in your glob pattern, they must be escaped with backslashes or quotes:
577
578**Special Characters**
579
580Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.
581
582To match any of the following characters as literals: `$^*+?()[]
583
584Examples:
585
586```js
587console.log(pm.makeRe('foo/bar \\(1\\)'));
588console.log(pm.makeRe('foo/bar \\(1\\)'));
589```
590
591<br>
592<br>
593
594## Library Comparisons
595
596The following table shows which features are supported by [minimatch](https://github.com/isaacs/minimatch), [micromatch](https://github.com/micromatch/micromatch), [picomatch](https://github.com/micromatch/picomatch), [nanomatch](https://github.com/micromatch/nanomatch), [extglob](https://github.com/micromatch/extglob), [braces](https://github.com/micromatch/braces), and [expand-brackets](https://github.com/micromatch/expand-brackets).
597
598| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |
599| --- | --- | --- | --- | --- | --- | --- | --- |
600| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |
601| Advancing globbing | ✔ | ✔ | ✔ | - | - | - | - |
602| Brace _matching_ | ✔ | ✔ | ✔ | - | - | ✔ | - |
603| Brace _expansion_ | ✔ | ✔ | - | - | - | ✔ | - |
604| Extglobs | partial | ✔ | ✔ | - | ✔ | - | - |
605| Posix brackets | - | ✔ | ✔ | - | - | - | ✔ |
606| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |
607| File system operations | - | - | - | - | - | - | - |
608
609<br>
610<br>
611
612## Benchmarks
613
614Performance comparison of picomatch and minimatch.
615
616```
617# .makeRe star
618 picomatch x 1,993,050 ops/sec ±0.51% (91 runs sampled)
619 minimatch x 627,206 ops/sec ±1.96% (87 runs sampled))
620
621# .makeRe star; dot=true
622 picomatch x 1,436,640 ops/sec ±0.62% (91 runs sampled)
623 minimatch x 525,876 ops/sec ±0.60% (88 runs sampled)
624
625# .makeRe globstar
626 picomatch x 1,592,742 ops/sec ±0.42% (90 runs sampled)
627 minimatch x 962,043 ops/sec ±1.76% (91 runs sampled)d)
628
629# .makeRe globstars
630 picomatch x 1,615,199 ops/sec ±0.35% (94 runs sampled)
631 minimatch x 477,179 ops/sec ±1.33% (91 runs sampled)
632
633# .makeRe with leading star
634 picomatch x 1,220,856 ops/sec ±0.40% (92 runs sampled)
635 minimatch x 453,564 ops/sec ±1.43% (94 runs sampled)
636
637# .makeRe - basic braces
638 picomatch x 392,067 ops/sec ±0.70% (90 runs sampled)
639 minimatch x 99,532 ops/sec ±2.03% (87 runs sampled))
640```
641
642<br>
643<br>
644
645## Philosophies
646
647The goal of this library is to be blazing fast, without compromising on accuracy.
648
649**Accuracy**
650
651The number one of goal of this library is accuracy. However, it's not unusual for different glob implementations to have different rules for matching behavior, even with simple wildcard matching. It gets increasingly more complicated when combinations of different features are combined, like when extglobs are combined with globstars, braces, slashes, and so on: `!(**/{a,b,*/c})`.
652
653Thus, given that there is no canonical glob specification to use as a single source of truth when differences of opinion arise regarding behavior, sometimes we have to implement our best judgement and rely on feedback from users to make improvements.
654
655**Performance**
656
657Although this library performs well in benchmarks, and in most cases it's faster than other popular libraries we benchmarked against, we will always choose accuracy over performance. It's not helpful to anyone if our library is faster at returning the wrong answer.
658
659<br>
660<br>
661
662## About
663
664<details>
665<summary><strong>Contributing</strong></summary>
666
667Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
668
669Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.
670
671</details>
672
673<details>
674<summary><strong>Running Tests</strong></summary>
675
676Running 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:
677
678```sh
679npm install && npm test
680```
681
682</details>
683
684<details>
685<summary><strong>Building docs</strong></summary>
686
687_(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.)_
688
689To generate the readme, run the following command:
690
691```sh
692npm install -g verbose/verb#dev verb-generate-readme && verb
693```
694
695</details>
696
697### Author
698
699**Jon Schlinkert**
700
701* [GitHub Profile](https://github.com/jonschlinkert)
702* [Twitter Profile](https://twitter.com/jonschlinkert)
703* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)
704
705### License
706
707Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).
708Released under the [MIT License](LICENSE).
Note: See TracBrowser for help on using the repository browser.