CoolFace
Apppublic

AK-21/Graphite-Industrial-Intelligence

sourceHugging Faceupdated 3mo agoView on Hugging Face
0likes
README.md750 linesDownload Raw Back to picomatch
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 dependencies32* **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 tests37 38See the [library comparison](#library-comparisons) to other libraries.39 40<br>41<br>42 43## Table of Contents44 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## Install83 84Install with [npm](https://www.npmjs.com/):85 86```sh87npm install --save picomatch88```89 90<br>91 92## Usage93 94The main export is a function that takes a glob pattern and an options object and returns a function for matching strings.95 96```js97const pm = require('picomatch');98const isMatch = pm('*.js');99 100console.log(isMatch('abcd')); //=> false101console.log(isMatch('a.js')); //=> true102console.log(isMatch('a.md')); //=> false103console.log(isMatch('a/b.js')); //=> false104```105 106<br>107 108## API109 110### [picomatch](lib/picomatch.js#L31)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```js123const picomatch = require('picomatch');124// picomatch(glob[, options]);125 126const isMatch = picomatch('*.!(*a)');127console.log(isMatch('a.a')); //=> false128console.log(isMatch('a.b')); //=> true129```130 131**Example without node.js**132 133For environments without `node.js`, `picomatch/posix` provides you a dependency-free matcher, without automatic OS detection.134 135```js136const picomatch = require('picomatch/posix');137// the same API, defaulting to posix paths138const isMatch = picomatch('a/*');139console.log(isMatch('a\\b')); //=> false140console.log(isMatch('a/b')); //=> true141 142// you can still configure the matcher function to accept windows paths143const isMatch = picomatch('a/*', { options: windows });144console.log(isMatch('a\\b')); //=> true145console.log(isMatch('a/b')); //=> true146```147 148### [.test](lib/picomatch.js#L116)149 150Test `input` with the given `regex`. This is used by the main `picomatch()` function to test the input string.151 152**Params**153 154* `input` **{String}**: String to test.155* `regex` **{RegExp}**156* `returns` **{Object}**: Returns an object with matching info.157 158**Example**159 160```js161const picomatch = require('picomatch');162// picomatch.test(input, regex[, options]);163 164console.log(picomatch.test('foo/bar', /^(?:([^/]*?)\/([^/]*?))$/));165// { isMatch: true, match: [ 'foo/', 'foo', 'bar' ], output: 'foo/bar' }166```167 168### [.matchBase](lib/picomatch.js#L160)169 170Match the basename of a filepath.171 172**Params**173 174* `input` **{String}**: String to test.175* `glob` **{RegExp|String}**: Glob pattern or regex created by [.makeRe](#makeRe).176* `returns` **{Boolean}**177 178**Example**179 180```js181const picomatch = require('picomatch');182// picomatch.matchBase(input, glob[, options]);183console.log(picomatch.matchBase('foo/bar.js', '*.js'); // true184```185 186### [.isMatch](lib/picomatch.js#L182)187 188Returns true if **any** of the given glob `patterns` match the specified `string`.189 190**Params**191 192* **{String|Array}**: str The string to test.193* **{String|Array}**: patterns One or more glob patterns to use for matching.194* **{Object}**: See available [options](#options).195* `returns` **{Boolean}**: Returns true if any patterns match `str`196 197**Example**198 199```js200const picomatch = require('picomatch');201// picomatch.isMatch(string, patterns[, options]);202 203console.log(picomatch.isMatch('a.a', ['b.*', '*.a'])); //=> true204console.log(picomatch.isMatch('a.a', 'b.*')); //=> false205```206 207### [.parse](lib/picomatch.js#L198)208 209Parse a glob pattern to create the source string for a regular expression.210 211**Params**212 213* `pattern` **{String}**214* `options` **{Object}**215* `returns` **{Object}**: Returns an object with useful properties and output to be used as a regex source string.216 217**Example**218 219```js220const picomatch = require('picomatch');221const result = picomatch.parse(pattern[, options]);222```223 224### [.scan](lib/picomatch.js#L230)225 226Scan a glob pattern to separate the pattern into segments.227 228**Params**229 230* `input` **{String}**: Glob pattern to scan.231* `options` **{Object}**232* `returns` **{Object}**: Returns an object with233 234**Example**235 236```js237const picomatch = require('picomatch');238// picomatch.scan(input[, options]);239 240const result = picomatch.scan('!./foo/*.js');241console.log(result);242{ prefix: '!./',243  input: '!./foo/*.js',244  start: 3,245  base: 'foo',246  glob: '*.js',247  isBrace: false,248  isBracket: false,249  isGlob: true,250  isExtglob: false,251  isGlobstar: false,252  negated: true }253```254 255### [.compileRe](lib/picomatch.js#L244)256 257Compile a regular expression from the `state` object returned by the258[parse()](#parse) method.259 260**Params**261 262* `state` **{Object}**263* `options` **{Object}**264* `returnOutput` **{Boolean}**: Intended for implementors, this argument allows you to return the raw output from the parser.265* `returnState` **{Boolean}**: Adds the state to a `state` property on the returned regex. Useful for implementors and debugging.266* `returns` **{RegExp}**267 268**Example**269 270```js271const picomatch = require('picomatch');272const state = picomatch.parse('*.js');273// picomatch.compileRe(state[, options]);274 275console.log(picomatch.compileRe(state));276//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/277```278 279### [.makeRe](lib/picomatch.js#L285)280 281Create a regular expression from a parsed glob pattern.282 283**Params**284 285* `state` **{String}**: The object returned from the `.parse` method.286* `options` **{Object}**287* `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.288* `returnState` **{Boolean}**: Implementors may use this argument to return the state from the parsed glob with the returned regular expression.289* `returns` **{RegExp}**: Returns a regex created from the given pattern.290 291**Example**292 293```js294const picomatch = require('picomatch');295// picomatch.makeRe(state[, options]);296 297const result = picomatch.makeRe('*.js');298console.log(result);299//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/300```301 302### [.toRegex](lib/picomatch.js#L320)303 304Create a regular expression from the given regex source string.305 306**Params**307 308* `source` **{String}**: Regular expression source string.309* `options` **{Object}**310* `returns` **{RegExp}**311 312**Example**313 314```js315const picomatch = require('picomatch');316// picomatch.toRegex(source[, options]);317 318const { output } = picomatch.parse('*.js');319console.log(picomatch.toRegex(output));320//=> /^(?:(?!\.)(?=.)[^/]*?\.js)$/321```322 323<br>324 325## Options326 327### Picomatch options328 329The following options may be used with the main `picomatch()` function or any of the methods on the picomatch API.330 331| **Option** | **Type** | **Default value** | **Description** |332| --- | --- | --- | --- |333| `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`. |334| `bash`                | `boolean`      | `false`     | Follow bash matching rules more strictly - disallows backslashes as escape characters, and treats single stars as globstars (`**`). |335| `capture`             | `boolean`      | `undefined` | Return regex matches in supporting methods. |336| `contains`            | `boolean`      | `undefined` | Allows glob to match any part of the given string(s). |337| `debug`               | `boolean`      | `undefined` | Debug regular expressions when an error is thrown. |338| `dot`                 | `boolean`      | `false`     | Enable dotfile matching. By default, dotfiles are ignored unless a `.` is explicitly defined in the pattern, or `options.dot` is true |339| `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. |340| `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`. |341| `flags`               | `string`      | `undefined` | Regex flags to use in the generated regex. If defined, the `nocase` option will be overridden. |342| [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. |343| `ignore`              | `array\|string` | `undefined` | One or more glob patterns for excluding strings that should not be matched from the result. |344| `keepQuotes`          | `boolean`      | `false`     | Retain quotes in the generated regex, since quotes may also be used as an alternative to backslashes.  |345| `literalBrackets`     | `boolean`      | `undefined` | When `true`, brackets in the glob pattern will be escaped so that only literal brackets will be matched. |346| `matchBase`           | `boolean`      | `false`     | Alias for `basename` |347| `maxLength`           | `number`      | `65536`     | Limit the max length of the input string. An error is thrown if the input string is longer than this value. |348| `maxExtglobRecursion` | `number\|boolean` | `0` | Limit nested quantified extglobs and other risky repeated extglob forms. When the limit is exceeded, the extglob is treated as a literal string instead of being compiled to regex. Set to `false` to disable this safeguard. |349| `nobrace`             | `boolean`      | `false`     | Disable brace matching, so that `{a,b}` and `{1..3}` would be treated as literal characters. |350| `nobracket`           | `boolean`      | `undefined` | Disable matching with regex brackets. |351| `nocase`              | `boolean`      | `false`     | Make matching case-insensitive. Equivalent to the regex `i` flag. Note that this option is overridden by the `flags` option. |352| `noext`               | `boolean`      | `false`     | Alias for `noextglob` |353| `noextglob`           | `boolean`      | `false`     | Disable support for matching with extglobs (like `+(a\|b)`) |354| `noglobstar`          | `boolean`      | `false`     | Disable support for matching nested directories with globstars (`**`) |355| `nonegate`            | `boolean`      | `false`     | Disable support for negating with leading `!` |356| [onIgnore](#optionsonIgnore) | `function` | `undefined` | Function to be called on ignored items. |357| [onMatch](#optionsonMatch) | `function` | `undefined` | Function to be called on matched items. |358| [onResult](#optionsonResult) | `function` | `undefined` | Function to be called on all items, regardless of whether or not they are matched or ignored. |359| `posix`               | `boolean`      | `false`     | Support POSIX character classes ("posix brackets"). |360| `prepend`             | `boolean`      | `undefined` | String to prepend to the generated regex used for matching. |361| `regex`               | `boolean`      | `false`     | Use regular expression rules for `+` (instead of matching literal `+`), and for stars that follow closing parentheses or brackets (as in `)*` and `]*`). |362| `strictBrackets`      | `boolean`      | `undefined` | Throw an error if brackets, braces, or parens are imbalanced. |363| `strictSlashes`       | `boolean`      | `undefined` | When true, picomatch won't match trailing slashes with single stars. |364| `unescape`            | `boolean`      | `undefined` | Remove backslashes preceding escaped characters in the glob pattern. By default, backslashes are retained. |365| `windows`             | `boolean`      | `false`     | Also accept backslashes as the path separator. |366 367### Scan Options368 369In addition to the main [picomatch options](#picomatch-options), the following options may also be used with the [.scan](#scan) method.370 371| **Option** | **Type** | **Default value** | **Description** |372| --- | --- | --- | --- |373| `tokens` | `boolean` | `false` | When `true`, the returned object will include an array of tokens (objects), representing each path "segment" in the scanned glob pattern |374| `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 |375 376**Example**377 378```js379const picomatch = require('picomatch');380const result = picomatch.scan('!./foo/*.js', { tokens: true });381console.log(result);382// {383//   prefix: '!./',384//   input: '!./foo/*.js',385//   start: 3,386//   base: 'foo',387//   glob: '*.js',388//   isBrace: false,389//   isBracket: false,390//   isGlob: true,391//   isExtglob: false,392//   isGlobstar: false,393//   negated: true,394//   maxDepth: 2,395//   tokens: [396//     { value: '!./', depth: 0, isGlob: false, negated: true, isPrefix: true },397//     { value: 'foo', depth: 1, isGlob: false },398//     { value: '*.js', depth: 1, isGlob: true }399//   ],400//   slashes: [ 2, 6 ],401//   parts: [ 'foo', '*.js' ]402// }403```404 405<br>406 407### Options Examples408 409#### options.expandRange410 411**Type**: `function`412 413**Default**: `undefined`414 415Custom 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.416 417**Example**418 419The following example shows how to create a glob that matches a folder420 421```js422const fill = require('fill-range');423const regex = pm.makeRe('foo/{01..25}/bar', {424  expandRange(a, b) {425    return `(${fill(a, b, { toRegex: true })})`;426  }427});428 429console.log(regex);430//=> /^(?:foo\/((?:0[1-9]|1[0-9]|2[0-5]))\/bar)$/431 432console.log(regex.test('foo/00/bar'))  // false433console.log(regex.test('foo/01/bar'))  // true434console.log(regex.test('foo/10/bar')) // true435console.log(regex.test('foo/22/bar')) // true436console.log(regex.test('foo/25/bar')) // true437console.log(regex.test('foo/26/bar')) // false438```439 440#### options.format441 442**Type**: `function`443 444**Default**: `undefined`445 446Custom function for formatting strings before they're matched.447 448**Example**449 450```js451// strip leading './' from strings452const format = str => str.replace(/^\.\//, '');453const isMatch = picomatch('foo/*.js', { format });454console.log(isMatch('./foo/bar.js')); //=> true455```456 457#### options.onMatch458 459```js460const onMatch = ({ glob, regex, input, output }) => {461  console.log({ glob, regex, input, output });462};463 464const isMatch = picomatch('*', { onMatch });465isMatch('foo');466isMatch('bar');467isMatch('baz');468```469 470#### options.onIgnore471 472```js473const onIgnore = ({ glob, regex, input, output }) => {474  console.log({ glob, regex, input, output });475};476 477const isMatch = picomatch('*', { onIgnore, ignore: 'f*' });478isMatch('foo');479isMatch('bar');480isMatch('baz');481```482 483#### options.onResult484 485```js486const onResult = ({ glob, regex, input, output }) => {487  console.log({ glob, regex, input, output });488};489 490const isMatch = picomatch('*', { onResult, ignore: 'f*' });491isMatch('foo');492isMatch('bar');493isMatch('baz');494```495 496<br>497<br>498 499## Globbing features500 501* [Basic globbing](#basic-globbing) (Wildcard matching)502* [Advanced globbing](#advanced-globbing) (extglobs, posix brackets, brace matching)503 504### Basic globbing505 506| **Character** | **Description** |507| --- | --- |508| `*` | 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`. |509| `**` | Matches any character zero or more times, including path separators. Note that `**` will only match path separators (`/`, and `\\` with the `windows` option) 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`. |510| `?` | Matches any character excluding path separators one time. Does _not match_ path separators or leading dots.  |511| `[abc]` | Matches any characters inside the brackets. For example, `[abc]` would match the characters `a`, `b` or `c`, and nothing else. |512 513#### Matching behavior vs. Bash514 515Picomatch'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:516 517* Bash will match `foo/bar/baz` with `*`. Picomatch only matches nested directories with `**`.518* 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`.519 520<br>521 522### Advanced globbing523 524* [extglobs](#extglobs)525* [POSIX brackets](#posix-brackets)526* [Braces](#brace-expansion)527 528#### Extglobs529 530| **Pattern** | **Description** |531| --- | --- |532| `@(pattern)` | Match _only one_ consecutive occurrence of `pattern` |533| `*(pattern)` | Match _zero or more_ consecutive occurrences of `pattern` |534| `+(pattern)` | Match _one or more_ consecutive occurrences of `pattern` |535| `?(pattern)` | Match _zero or **one**_ consecutive occurrences of `pattern` |536| `!(pattern)` | Match _anything but_ `pattern` |537 538**Examples**539 540```js541const pm = require('picomatch');542 543// *(pattern) matches ZERO or more of "pattern"544console.log(pm.isMatch('a', 'a*(z)')); // true545console.log(pm.isMatch('az', 'a*(z)')); // true546console.log(pm.isMatch('azzz', 'a*(z)')); // true547 548// +(pattern) matches ONE or more of "pattern"549console.log(pm.isMatch('a', 'a+(z)')); // false550console.log(pm.isMatch('az', 'a+(z)')); // true551console.log(pm.isMatch('azzz', 'a+(z)')); // true552 553// supports multiple extglobs554console.log(pm.isMatch('foo.bar', '!(foo).!(bar)')); // false555 556// supports nested extglobs557console.log(pm.isMatch('foo.bar', '!(!(foo)).!(!(bar))')); // true558 559// risky quantified extglobs are treated literally by default560console.log(pm.makeRe('+(a|aa)'));561//=> /^(?:\+\(a\|aa\))$/562 563// increase the limit to allow a small amount of nested quantified extglobs564console.log(pm.isMatch('aaa', '+(+(a))', { maxExtglobRecursion: 1 })); // true565```566 567#### POSIX brackets568 569POSIX classes are disabled by default. Enable this feature by setting the `posix` option to true.570 571**Enable POSIX bracket support**572 573```js574console.log(pm.makeRe('[[:word:]]+', { posix: true }));575//=> /^(?:(?=.)[A-Za-z0-9_]+\/?)$/576```577 578**Supported POSIX classes**579 580The following named POSIX bracket expressions are supported:581 582* `[:alnum:]` - Alphanumeric characters, equ `[a-zA-Z0-9]`583* `[:alpha:]` - Alphabetical characters, equivalent to `[a-zA-Z]`.584* `[:ascii:]` - ASCII characters, equivalent to `[\\x00-\\x7F]`.585* `[:blank:]` - Space and tab characters, equivalent to `[ \\t]`.586* `[:cntrl:]` - Control characters, equivalent to `[\\x00-\\x1F\\x7F]`.587* `[:digit:]` - Numerical digits, equivalent to `[0-9]`.588* `[:graph:]` - Graph characters, equivalent to `[\\x21-\\x7E]`.589* `[:lower:]` - Lowercase letters, equivalent to `[a-z]`.590* `[:print:]` - Print characters, equivalent to `[\\x20-\\x7E ]`.591* `[:punct:]` - Punctuation and symbols, equivalent to `[\\-!"#$%&\'()\\*+,./:;<=>?@[\\]^_`{|}~]`.592* `[:space:]` - Extended space characters, equivalent to `[ \\t\\r\\n\\v\\f]`.593* `[:upper:]` - Uppercase letters, equivalent to `[A-Z]`.594* `[:word:]` -  Word characters (letters, numbers and underscores), equivalent to `[A-Za-z0-9_]`.595* `[:xdigit:]` - Hexadecimal digits, equivalent to `[A-Fa-f0-9]`.596 597See the [Bash Reference Manual](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html) for more information.598 599### Braces600 601Picomatch only does [brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) of comma-delimited lists (e.g. `a/{b,c}/d`). For advanced matching with braces, use [micromatch](https://github.com/micromatch/micromatch), which supports advanced syntax such as ranges (e.g. `{01..03}`) and increments (e.g. `{2..10..2}`).602 603### Matching special characters as literals604 605If 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:606 607**Special Characters**608 609Some characters that are used for matching in regular expressions are also regarded as valid file path characters on some platforms.610 611To match any of the following characters as literals: `$^*+?()[]612 613Examples:614 615```js616console.log(pm.makeRe('foo/bar \\(1\\)'));617console.log(pm.makeRe('foo/bar \\(1\\)'));618```619 620<br>621<br>622 623## Library Comparisons624 625The 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).626 627| **Feature** | `minimatch` | `micromatch` | `picomatch` | `nanomatch` | `extglob` | `braces` | `expand-brackets` |628| --- | --- | --- | --- | --- | --- | --- | --- |629| Wildcard matching (`*?+`) | ✔ | ✔ | ✔ | ✔ | - | - | - |630| Advancing globbing        | ✔ | ✔ | ✔ | - | - | - | - |631| Brace _matching_          | ✔ | ✔ | ✔ | - | - | ✔ | - |632| Brace _expansion_         | ✔ | ✔ | - | - | - | ✔ | - |633| Extglobs                  | partial | ✔ | ✔ | - | ✔ | - | - |634| Posix brackets            | - | ✔ | ✔ | - | - | - | ✔ |635| Regular expression syntax | - | ✔ | ✔ | ✔ | ✔ | - | ✔ |636| File system operations    | - | - | - | - | - | - | - |637 638<br>639<br>640 641## Benchmarks642 643Performance comparison of picomatch and minimatch.644 645```646# .makeRe star (*)647  picomatch x 3,251,247 ops/sec ±0.25% (95 runs sampled)648  minimatch x 497,224 ops/sec ±0.11% (100 runs sampled)649 650# .makeRe star; dot=true (*)651  picomatch x 2,624,035 ops/sec ±0.16% (98 runs sampled)652  minimatch x 446,244 ops/sec ±0.63% (99 runs sampled)653 654# .makeRe globstar (**)655  picomatch x 2,524,465 ops/sec ±0.13% (99 runs sampled)656  minimatch x 1,396,257 ops/sec ±0.58% (96 runs sampled)657 658# .makeRe globstars (**/**/**)659  picomatch x 2,545,674 ops/sec ±0.10% (99 runs sampled)660  minimatch x 1,196,835 ops/sec ±0.63% (98 runs sampled)661 662# .makeRe with leading star (*.txt)663  picomatch x 2,537,708 ops/sec ±0.11% (100 runs sampled)664  minimatch x 345,284 ops/sec ±0.64% (96 runs sampled)665 666# .makeRe - basic braces ({a,b,c}*.txt)667  picomatch x 505,430 ops/sec ±1.04% (94 runs sampled)668  minimatch x 107,991 ops/sec ±0.54% (99 runs sampled)669 670# .makeRe - short ranges ({a..z}*.txt)671  picomatch x 371,179 ops/sec ±2.91% (77 runs sampled)672  minimatch x 14,104 ops/sec ±0.61% (99 runs sampled)673 674# .makeRe - medium ranges ({1..100000}*.txt)675  picomatch x 384,958 ops/sec ±1.70% (82 runs sampled)676  minimatch x 2.55 ops/sec ±3.22% (11 runs sampled)677 678# .makeRe - long ranges ({1..10000000}*.txt)679  picomatch x 382,552 ops/sec ±1.52% (71 runs sampled)680  minimatch x 0.83 ops/sec ±5.67% (7 runs sampled))681```682 683<br>684<br>685 686## Philosophies687 688The goal of this library is to be blazing fast, without compromising on accuracy.689 690**Accuracy**691 692The 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})`.693 694Thus, 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.695 696**Performance**697 698Although 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.699 700<br>701<br>702 703## About704 705<details>706<summary><strong>Contributing</strong></summary>707 708Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).709 710Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards.711 712</details>713 714<details>715<summary><strong>Running Tests</strong></summary>716 717Running 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:718 719```sh720npm install && npm test721```722 723</details>724 725<details>726<summary><strong>Building docs</strong></summary>727 728_(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.)_729 730To generate the readme, run the following command:731 732```sh733npm install -g verbose/verb#dev verb-generate-readme && verb734```735 736</details>737 738### Author739 740**Jon Schlinkert**741 742* [GitHub Profile](https://github.com/jonschlinkert)743* [Twitter Profile](https://twitter.com/jonschlinkert)744* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)745 746### License747 748Copyright © 2017-present, [Jon Schlinkert](https://github.com/jonschlinkert).749Released under the [MIT License](LICENSE).750