diff options
Diffstat (limited to 'node_modules/nanomatch/README.md')
-rw-r--r-- | node_modules/nanomatch/README.md | 173 |
1 files changed, 113 insertions, 60 deletions
diff --git a/node_modules/nanomatch/README.md b/node_modules/nanomatch/README.md index b3579b4da..f6ada2fbf 100644 --- a/node_modules/nanomatch/README.md +++ b/node_modules/nanomatch/README.md @@ -2,9 +2,14 @@ > Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash 4.3 wildcard support only (no support for exglobs, posix brackets or braces) +Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support. + +## Table of Contents + <details> -<summary><strong>Table of Contents</strong></summary> +<summary><strong>Details</strong></summary> +- [Install](#install) - [What is nanomatch?](#what-is-nanomatch) - [Getting started](#getting-started) * [Installing nanomatch](#installing-nanomatch) @@ -36,14 +41,17 @@ * [Running benchmarks](#running-benchmarks) * [Latest results](#latest-results) - [About](#about) - * [Related projects](#related-projects) - * [Contributing](#contributing) - * [Running tests](#running-tests) - * [Author](#author) - * [License](#license) </details> +## Install + +Install with [npm](https://www.npmjs.com/): + +```sh +$ npm install --save nanomatch +``` + <details> <summary><strong>Release history</strong></summary> @@ -128,7 +136,7 @@ Nanomatch uses [snapdragon](https://github.com/jonschlinkert/snapdragon) for par Nanomatch supports [basic globbing only](#features), which is limited to `*`, `**`, `?` and regex-like brackets. -If you need support for the other [bash "expansion" types](#bash-expansion-libs) (in addition to the wildcard matching provided by nanomatch), consider using [micromatch](https://github.com/jonschlinkert/micromatch) instead. _(micromatch >=3.0.0 uses the nanomatch parser and compiler for basic glob matching)_ +If you need support for the other [bash "expansion" types](#bash-expansion-libs) (in addition to the wildcard matching provided by nanomatch), consider using [micromatch](https://github.com/micromatch/micromatch) instead. _(micromatch >=3.0.0 uses the nanomatch parser and compiler for basic glob matching)_ </details> @@ -485,7 +493,30 @@ console.log(isMatch('a.b')); //=> true ``` -### [.makeRe](index.js#L553) +### [.capture](index.js#L560) + +Returns an array of matches captured by `pattern` in `string, or`null` if the pattern did not match. + +**Params** + +* `pattern` **{String}**: Glob pattern to use for matching. +* `string` **{String}**: String to match +* `options` **{Object}**: See available [options](#options) for changing how matches are performed +* `returns` **{Boolean}**: Returns an array of captures if the string matches the glob pattern, otherwise `null`. + +**Example** + +```js +var nm = require('nanomatch'); +nm.capture(pattern, string[, options]); + +console.log(nm.capture('test/*.js', 'test/foo.js')); +//=> ['foo'] +console.log(nm.capture('test/*.js', 'foo/bar.css')); +//=> null +``` + +### [.makeRe](index.js#L595) Create a regular expression from the given glob `pattern`. @@ -505,7 +536,7 @@ console.log(nm.makeRe('*.js')); //=> /^(?:(\.[\\\/])?(?!\.)(?=.)[^\/]*?\.js)$/ ``` -### [.create](index.js#L616) +### [.create](index.js#L662) Parses the given glob `pattern` and returns an object with the compiled `output` and optional source `map`. @@ -547,7 +578,7 @@ console.log(nm.create('abc/*.js')); // idx: 6 } ``` -### [.parse](index.js#L655) +### [.parse](index.js#L701) Parse the given `str` with the given `options`. @@ -580,7 +611,7 @@ console.log(ast); // { type: 'eos', val: '' } ] } ``` -### [.compile](index.js#L703) +### [.compile](index.js#L749) Compile the given `ast` or string with the given `options`. @@ -614,7 +645,7 @@ console.log(nm.compile(ast)); // parsingErrors: [] } ``` -### [.clearCache](index.js#L726) +### [.clearCache](index.js#L772) Clear the regex cache. @@ -946,7 +977,7 @@ The following extended-globbing features are not supported: * [extglobs](https://github.com/jonschlinkert/extglob) (e.g. `@(a|!(c|d))`) * [POSIX brackets](https://github.com/jonschlinkert/expand-brackets) (e.g. `[[:alpha:][:digit:]]`) -If you need any of these features consider using [micromatch](https://github.com/jonschlinkert/micromatch) instead. +If you need any of these features consider using [micromatch](https://github.com/micromatch/micromatch) instead. ## Bash expansion libs @@ -959,7 +990,7 @@ Nanomatch is part of a suite of libraries aimed at bringing the power and expres | [braces](https://github.com/jonschlinkert/braces) | Braces | `{a,b,c}` | [Brace expansion](https://www.gnu.org/software/bash/manual/html_node/Brace-Expansion.html) | | [expand-brackets](https://github.com/jonschlinkert/expand-brackets) | Brackets | `[[:alpha:]]` | [POSIX character classes](https://www.gnu.org/software/grep/manual/html_node/Character-Classes-and-Bracket-Expressions.html) (also referred to as POSIX brackets, or POSIX character classes) | | [extglob](https://github.com/jonschlinkert/extglob) | Parens | `!(a\ | b)` | [Extglobs](https://www.gnu.org/software/bash/manual/html_node/Pattern-Matching.html#Pattern-Matching) | -| [micromatch](https://github.com/jonschlinkert/micromatch) | All | all | Micromatch is built on top of the other libraries. | +| [micromatch](https://github.com/micromatch/micromatch) | All | all | Micromatch is built on top of the other libraries. | There are many resources available on the web if you want to dive deeper into how these features work in Bash. @@ -976,72 +1007,63 @@ npm i -d && node benchmark ### Latest results ```bash -Benchmarking: (6 of 6) - · globstar-basic - · large-list-globstar - · long-list-globstar - · negation-basic - · not-glob-basic - · star-basic - -# benchmark/fixtures/match/globstar-basic.js (182 bytes) - minimatch x 31,046 ops/sec ±0.56% (87 runs sampled) - multimatch x 27,787 ops/sec ±1.02% (88 runs sampled) - nanomatch x 453,686 ops/sec ±1.11% (89 runs sampled) +# globstar-basic (182 bytes) + minimatch x 70,508 ops/sec ±0.44% (92 runs sampled) + multimatch x 63,220 ops/sec ±0.76% (94 runs sampled) + nanomatch x 377,146 ops/sec ±0.45% (89 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 564% avg) -# benchmark/fixtures/match/large-list-globstar.js (485686 bytes) - minimatch x 25.23 ops/sec ±0.46% (44 runs sampled) - multimatch x 25.20 ops/sec ±0.97% (43 runs sampled) - nanomatch x 735 ops/sec ±0.66% (89 runs sampled) +# large-list-globstar (485686 bytes) + minimatch x 35.67 ops/sec ±0.47% (61 runs sampled) + multimatch x 34.80 ops/sec ±1.77% (60 runs sampled) + nanomatch x 509 ops/sec ±0.43% (90 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 1445% avg) -# benchmark/fixtures/match/long-list-globstar.js (194085 bytes) - minimatch x 258 ops/sec ±0.87% (83 runs sampled) - multimatch x 264 ops/sec ±0.90% (82 runs sampled) - nanomatch x 1,858 ops/sec ±0.56% (89 runs sampled) +# long-list-globstar (194085 bytes) + minimatch x 397 ops/sec ±0.96% (89 runs sampled) + multimatch x 400 ops/sec ±0.32% (90 runs sampled) + nanomatch x 843 ops/sec ±0.40% (92 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 212% avg) -# benchmark/fixtures/match/negation-basic.js (132 bytes) - minimatch x 74,240 ops/sec ±1.22% (88 runs sampled) - multimatch x 25,360 ops/sec ±1.18% (89 runs sampled) - nanomatch x 545,835 ops/sec ±1.12% (88 runs sampled) +# negation-basic (132 bytes) + minimatch x 224,342 ops/sec ±1.07% (90 runs sampled) + multimatch x 68,071 ops/sec ±0.80% (89 runs sampled) + nanomatch x 442,204 ops/sec ±1.09% (91 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 302% avg) -# benchmark/fixtures/match/not-glob-basic.js (93 bytes) - minimatch x 92,753 ops/sec ±1.59% (86 runs sampled) - multimatch x 50,125 ops/sec ±1.43% (87 runs sampled) - nanomatch x 1,195,648 ops/sec ±1.18% (87 runs sampled) +# not-glob-basic (93 bytes) + minimatch x 222,156 ops/sec ±0.98% (89 runs sampled) + multimatch x 179,724 ops/sec ±1.04% (91 runs sampled) + nanomatch x 1,446,098 ops/sec ±0.45% (92 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 720% avg) -# benchmark/fixtures/match/star-basic.js (93 bytes) - minimatch x 70,746 ops/sec ±1.51% (86 runs sampled) - multimatch x 54,317 ops/sec ±1.45% (89 runs sampled) - nanomatch x 602,748 ops/sec ±1.17% (86 runs sampled) +# star-basic (93 bytes) + minimatch x 165,049 ops/sec ±1.22% (91 runs sampled) + multimatch x 132,553 ops/sec ±0.57% (90 runs sampled) + nanomatch x 522,080 ops/sec ±1.20% (92 runs sampled) - fastest is nanomatch + fastest is nanomatch (by 351% avg) ``` ## About -### Related projects - -* [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob "Returns true if a string has an extglob.") -* [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") - -### Contributing +<details> +<summary><strong>Contributing</strong></summary> Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new). Please read the [contributing guide](.github/contributing.md) for advice on opening issues, pull requests, and coding standards. -### Running tests +</details> + +<details> +<summary><strong>Running Tests</strong></summary> 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: @@ -1049,6 +1071,37 @@ Running and reviewing unit tests is a great way to get familiarized with a libra $ npm install && npm test ``` +</details> + +<details> +<summary><strong>Building docs</strong></summary> + +_(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.)_ + +To generate the readme, run the following command: + +```sh +$ npm install -g verbose/verb#dev verb-generate-readme && verb +``` + +</details> + +### Related projects + +You might also be interested in these projects: + +* [extglob](https://www.npmjs.com/package/extglob): Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob… [more](https://github.com/micromatch/extglob) | [homepage](https://github.com/micromatch/extglob "Extended glob support for JavaScript. Adds (almost) the expressive power of regular expressions to glob patterns.") +* [is-extglob](https://www.npmjs.com/package/is-extglob): Returns true if a string has an extglob. | [homepage](https://github.com/jonschlinkert/is-extglob "Returns true if a string has an extglob.") +* [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") +* [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.") + +### Contributors + +| **Commits** | **Contributor** | +| --- | --- | +| 144 | [jonschlinkert](https://github.com/jonschlinkert) | +| 1 | [devongovett](https://github.com/devongovett) | + ### Author **Jon Schlinkert** @@ -1063,4 +1116,4 @@ Released under the [MIT License](LICENSE). *** -_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on May 28, 2017._
\ No newline at end of file +_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on October 20, 2017._
\ No newline at end of file |