You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

639 lines
23 KiB

4 years ago
  1. # braces [![NPM version](https://img.shields.io/npm/v/braces.svg?style=flat)](https://www.npmjs.com/package/braces) [![NPM monthly downloads](https://img.shields.io/npm/dm/braces.svg?style=flat)](https://npmjs.org/package/braces) [![NPM total downloads](https://img.shields.io/npm/dt/braces.svg?style=flat)](https://npmjs.org/package/braces) [![Linux Build Status](https://img.shields.io/travis/micromatch/braces.svg?style=flat&label=Travis)](https://travis-ci.org/micromatch/braces) [![Windows Build Status](https://img.shields.io/appveyor/ci/micromatch/braces.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/micromatch/braces)
  2. > 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.
  3. Please consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.
  4. ## Install
  5. Install with [npm](https://www.npmjs.com/):
  6. ```sh
  7. $ npm install --save braces
  8. ```
  9. ## Why use braces?
  10. Brace patterns are great for matching ranges. Users (and implementors) shouldn't have to think about whether or not they will break their application (or yours) from accidentally defining an aggressive brace pattern. _Braces is the only library that offers a [solution to this problem](#performance)_.
  11. * **Safe(r)**: Braces isn't vulnerable to DoS attacks like [brace-expansion](https://github.com/juliangruber/brace-expansion), [minimatch](https://github.com/isaacs/minimatch) and [multimatch](https://github.com/sindresorhus/multimatch) (a different bug than the [other regex DoS bug](https://medium.com/node-security/minimatch-redos-vulnerability-590da24e6d3c#.jew0b6mpc)).
  12. * **Accurate**: complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
  13. * **[fast and performant](#benchmarks)**: Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
  14. * **Organized code base**: with parser and compiler that are eas(y|ier) to maintain and update when edge cases crop up.
  15. * **Well-tested**: thousands of test assertions. Passes 100% of the [minimatch](https://github.com/isaacs/minimatch) and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests as well (as of the writing of this).
  16. ## Usage
  17. The main export is a function that takes one or more brace `patterns` and `options`.
  18. ```js
  19. var braces = require('braces');
  20. braces(pattern[, options]);
  21. ```
  22. By default, braces returns an optimized regex-source string. To get an array of brace patterns, use `brace.expand()`.
  23. The following section explains the difference in more detail. _(If you're curious about "why" braces does this by default, see [brace matching pitfalls](#brace-matching-pitfalls)_.
  24. ### Optimized vs. expanded braces
  25. **Optimized**
  26. By default, patterns are optimized for regex and matching:
  27. ```js
  28. console.log(braces('a/{x,y,z}/b'));
  29. //=> ['a/(x|y|z)/b']
  30. ```
  31. **Expanded**
  32. To expand patterns the same way as Bash or [minimatch](https://github.com/isaacs/minimatch), use the [.expand](#expand) method:
  33. ```js
  34. console.log(braces.expand('a/{x,y,z}/b'));
  35. //=> ['a/x/b', 'a/y/b', 'a/z/b']
  36. ```
  37. Or use [options.expand](#optionsexpand):
  38. ```js
  39. console.log(braces('a/{x,y,z}/b', {expand: true}));
  40. //=> ['a/x/b', 'a/y/b', 'a/z/b']
  41. ```
  42. ## Features
  43. * [lists](#lists): Supports "lists": `a/{b,c}/d` => `['a/b/d', 'a/c/d']`
  44. * [sequences](#sequences): Supports alphabetical or numerical "sequences" (ranges): `{1..3}` => `['1', '2', '3']`
  45. * [steps](#steps): Supports "steps" or increments: `{2..10..2}` => `['2', '4', '6', '8', '10']`
  46. * [escaping](#escaping)
  47. * [options](#options)
  48. ### Lists
  49. Uses [fill-range](https://github.com/jonschlinkert/fill-range) for expanding alphabetical or numeric lists:
  50. ```js
  51. console.log(braces('a/{foo,bar,baz}/*.js'));
  52. //=> ['a/(foo|bar|baz)/*.js']
  53. console.log(braces.expand('a/{foo,bar,baz}/*.js'));
  54. //=> ['a/foo/*.js', 'a/bar/*.js', 'a/baz/*.js']
  55. ```
  56. ### Sequences
  57. Uses [fill-range](https://github.com/jonschlinkert/fill-range) for expanding alphabetical or numeric ranges (bash "sequences"):
  58. ```js
  59. console.log(braces.expand('{1..3}')); // ['1', '2', '3']
  60. console.log(braces.expand('a{01..03}b')); // ['a01b', 'a02b', 'a03b']
  61. console.log(braces.expand('a{1..3}b')); // ['a1b', 'a2b', 'a3b']
  62. console.log(braces.expand('{a..c}')); // ['a', 'b', 'c']
  63. console.log(braces.expand('foo/{a..c}')); // ['foo/a', 'foo/b', 'foo/c']
  64. // supports padded ranges
  65. console.log(braces('a{01..03}b')); //=> [ 'a(0[1-3])b' ]
  66. console.log(braces('a{001..300}b')); //=> [ 'a(0{2}[1-9]|0[1-9][0-9]|[12][0-9]{2}|300)b' ]
  67. ```
  68. ### Steps
  69. Steps, or increments, may be used with ranges:
  70. ```js
  71. console.log(braces.expand('{2..10..2}'));
  72. //=> ['2', '4', '6', '8', '10']
  73. console.log(braces('{2..10..2}'));
  74. //=> ['(2|4|6|8|10)']
  75. ```
  76. When the [.optimize](#optimize) method is used, or [options.optimize](#optionsoptimize) is set to true, sequences are passed to [to-regex-range](https://github.com/jonschlinkert/to-regex-range) for expansion.
  77. ### Nesting
  78. Brace patterns may be nested. The results of each expanded string are not sorted, and left to right order is preserved.
  79. **"Expanded" braces**
  80. ```js
  81. console.log(braces.expand('a{b,c,/{x,y}}/e'));
  82. //=> ['ab/e', 'ac/e', 'a/x/e', 'a/y/e']
  83. console.log(braces.expand('a/{x,{1..5},y}/c'));
  84. //=> ['a/x/c', 'a/1/c', 'a/2/c', 'a/3/c', 'a/4/c', 'a/5/c', 'a/y/c']
  85. ```
  86. **"Optimized" braces**
  87. ```js
  88. console.log(braces('a{b,c,/{x,y}}/e'));
  89. //=> ['a(b|c|/(x|y))/e']
  90. console.log(braces('a/{x,{1..5},y}/c'));
  91. //=> ['a/(x|([1-5])|y)/c']
  92. ```
  93. ### Escaping
  94. **Escaping braces**
  95. A brace pattern will not be expanded or evaluted if _either the opening or closing brace is escaped_:
  96. ```js
  97. console.log(braces.expand('a\\{d,c,b}e'));
  98. //=> ['a{d,c,b}e']
  99. console.log(braces.expand('a{d,c,b\\}e'));
  100. //=> ['a{d,c,b}e']
  101. ```
  102. **Escaping commas**
  103. Commas inside braces may also be escaped:
  104. ```js
  105. console.log(braces.expand('a{b\\,c}d'));
  106. //=> ['a{b,c}d']
  107. console.log(braces.expand('a{d\\,c,b}e'));
  108. //=> ['ad,ce', 'abe']
  109. ```
  110. **Single items**
  111. Following bash conventions, a brace pattern is also not expanded when it contains a single character:
  112. ```js
  113. console.log(braces.expand('a{b}c'));
  114. //=> ['a{b}c']
  115. ```
  116. ## Options
  117. ### options.maxLength
  118. **Type**: `Number`
  119. **Default**: `65,536`
  120. **Description**: Limit the length of the input string. Useful when the input string is generated or your application allows users to pass a string, et cetera.
  121. ```js
  122. console.log(braces('a/{b,c}/d', { maxLength: 3 })); //=> throws an error
  123. ```
  124. ### options.expand
  125. **Type**: `Boolean`
  126. **Default**: `undefined`
  127. **Description**: Generate an "expanded" brace pattern (this option is unncessary with the `.expand` method, which does the same thing).
  128. ```js
  129. console.log(braces('a/{b,c}/d', {expand: true}));
  130. //=> [ 'a/b/d', 'a/c/d' ]
  131. ```
  132. ### options.optimize
  133. **Type**: `Boolean`
  134. **Default**: `true`
  135. **Description**: Enabled by default.
  136. ```js
  137. console.log(braces('a/{b,c}/d'));
  138. //=> [ 'a/(b|c)/d' ]
  139. ```
  140. ### options.nodupes
  141. **Type**: `Boolean`
  142. **Default**: `true`
  143. **Description**: Duplicates are removed by default. To keep duplicates, pass `{nodupes: false}` on the options
  144. ### options.rangeLimit
  145. **Type**: `Number`
  146. **Default**: `250`
  147. **Description**: When `braces.expand()` is used, or `options.expand` is true, brace patterns will automatically be [optimized](#optionsoptimize) when the difference between the range minimum and range maximum exceeds the `rangeLimit`. This is to prevent huge ranges from freezing your application.
  148. You can set this to any number, or change `options.rangeLimit` to `Inifinity` to disable this altogether.
  149. **Examples**
  150. ```js
  151. // pattern exceeds the "rangeLimit", so it's optimized automatically
  152. console.log(braces.expand('{1..1000}'));
  153. //=> ['([1-9]|[1-9][0-9]{1,2}|1000)']
  154. // pattern does not exceed "rangeLimit", so it's NOT optimized
  155. console.log(braces.expand('{1..100}'));
  156. //=> ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30', '31', '32', '33', '34', '35', '36', '37', '38', '39', '40', '41', '42', '43', '44', '45', '46', '47', '48', '49', '50', '51', '52', '53', '54', '55', '56', '57', '58', '59', '60', '61', '62', '63', '64', '65', '66', '67', '68', '69', '70', '71', '72', '73', '74', '75', '76', '77', '78', '79', '80', '81', '82', '83', '84', '85', '86', '87', '88', '89', '90', '91', '92', '93', '94', '95', '96', '97', '98', '99', '100']
  157. ```
  158. ### options.transform
  159. **Type**: `Function`
  160. **Default**: `undefined`
  161. **Description**: Customize range expansion.
  162. ```js
  163. var range = braces.expand('x{a..e}y', {
  164. transform: function(str) {
  165. return 'foo' + str;
  166. }
  167. });
  168. console.log(range);
  169. //=> [ 'xfooay', 'xfooby', 'xfoocy', 'xfoody', 'xfooey' ]
  170. ```
  171. ### options.quantifiers
  172. **Type**: `Boolean`
  173. **Default**: `undefined`
  174. **Description**: In regular expressions, quanitifiers can be used to specify how many times a token can be repeated. For example, `a{1,3}` will match the letter `a` one to three times.
  175. Unfortunately, regex quantifiers happen to share the same syntax as [Bash lists](#lists)
  176. The `quantifiers` option tells braces to detect when [regex quantifiers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#quantifiers) are defined in the given pattern, and not to try to expand them as lists.
  177. **Examples**
  178. ```js
  179. var braces = require('braces');
  180. console.log(braces('a/b{1,3}/{x,y,z}'));
  181. //=> [ 'a/b(1|3)/(x|y|z)' ]
  182. console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true}));
  183. //=> [ 'a/b{1,3}/(x|y|z)' ]
  184. console.log(braces('a/b{1,3}/{x,y,z}', {quantifiers: true, expand: true}));
  185. //=> [ 'a/b{1,3}/x', 'a/b{1,3}/y', 'a/b{1,3}/z' ]
  186. ```
  187. ### options.unescape
  188. **Type**: `Boolean`
  189. **Default**: `undefined`
  190. **Description**: Strip backslashes that were used for escaping from the result.
  191. ## What is "brace expansion"?
  192. Brace expansion is a type of parameter expansion that was made popular by unix shells for generating lists of strings, as well as regex-like matching when used alongside wildcards (globs).
  193. In addition to "expansion", braces are also used for matching. In other words:
  194. * [brace expansion](#brace-expansion) is for generating new lists
  195. * [brace matching](#brace-matching) is for filtering existing lists
  196. <details>
  197. <summary><strong>More about brace expansion</strong> (click to expand)</summary>
  198. There are two main types of brace expansion:
  199. 1. **lists**: which are defined using comma-separated values inside curly braces: `{a,b,c}`
  200. 2. **sequences**: which are defined using a starting value and an ending value, separated by two dots: `a{1..3}b`. Optionally, a third argument may be passed to define a "step" or increment to use: `a{1..100..10}b`. These are also sometimes referred to as "ranges".
  201. Here are some example brace patterns to illustrate how they work:
  202. **Sets**
  203. ```
  204. {a,b,c} => a b c
  205. {a,b,c}{1,2} => a1 a2 b1 b2 c1 c2
  206. ```
  207. **Sequences**
  208. ```
  209. {1..9} => 1 2 3 4 5 6 7 8 9
  210. {4..-4} => 4 3 2 1 0 -1 -2 -3 -4
  211. {1..20..3} => 1 4 7 10 13 16 19
  212. {a..j} => a b c d e f g h i j
  213. {j..a} => j i h g f e d c b a
  214. {a..z..3} => a d g j m p s v y
  215. ```
  216. **Combination**
  217. Sets and sequences can be mixed together or used along with any other strings.
  218. ```
  219. {a,b,c}{1..3} => a1 a2 a3 b1 b2 b3 c1 c2 c3
  220. foo/{a,b,c}/bar => foo/a/bar foo/b/bar foo/c/bar
  221. ```
  222. The fact that braces can be "expanded" from relatively simple patterns makes them ideal for quickly generating test fixtures, file paths, and similar use cases.
  223. ## Brace matching
  224. In addition to _expansion_, brace patterns are also useful for performing regular-expression-like matching.
  225. For example, the pattern `foo/{1..3}/bar` would match any of following strings:
  226. ```
  227. foo/1/bar
  228. foo/2/bar
  229. foo/3/bar
  230. ```
  231. But not:
  232. ```
  233. baz/1/qux
  234. baz/2/qux
  235. baz/3/qux
  236. ```
  237. Braces can also be combined with [glob patterns](https://github.com/jonschlinkert/micromatch) to perform more advanced wildcard matching. For example, the pattern `*/{1..3}/*` would match any of following strings:
  238. ```
  239. foo/1/bar
  240. foo/2/bar
  241. foo/3/bar
  242. baz/1/qux
  243. baz/2/qux
  244. baz/3/qux
  245. ```
  246. ## Brace matching pitfalls
  247. Although brace patterns offer a user-friendly way of matching ranges or sets of strings, there are also some major disadvantages and potential risks you should be aware of.
  248. ### tldr
  249. **"brace bombs"**
  250. * brace expansion can eat up a huge amount of processing resources
  251. * as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
  252. * users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
  253. For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
  254. ### The solution
  255. Jump to the [performance section](#performance) to see how Braces solves this problem in comparison to other libraries.
  256. ### Geometric complexity
  257. At minimum, brace patterns with sets limited to two elements have quadradic or `O(n^2)` complexity. But the complexity of the algorithm increases exponentially as the number of sets, _and elements per set_, increases, which is `O(n^c)`.
  258. For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
  259. ```
  260. {1,2}{3,4} => (2X2) => 13 14 23 24
  261. {1,2}{3,4}{5,6} => (2X2X2) => 135 136 145 146 235 236 245 246
  262. ```
  263. But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
  264. ```
  265. {1,2,3}{4,5,6}{7,8,9} => (3X3X3) => 147 148 149 157 158 159 167 168 169 247 248
  266. 249 257 258 259 267 268 269 347 348 349 357
  267. 358 359 367 368 369
  268. ```
  269. Now, imagine how this complexity grows given that each element is a n-tuple:
  270. ```
  271. {1..100}{1..100} => (100X100) => 10,000 elements (38.4 kB)
  272. {1..100}{1..100}{1..100} => (100X100X100) => 1,000,000 elements (5.76 MB)
  273. ```
  274. Although these examples are clearly contrived, they demonstrate how brace patterns can quickly grow out of control.
  275. **More information**
  276. Interested in learning more about brace expansion?
  277. * [linuxjournal/bash-brace-expansion](http://www.linuxjournal.com/content/bash-brace-expansion)
  278. * [rosettacode/Brace_expansion](https://rosettacode.org/wiki/Brace_expansion)
  279. * [cartesian product](https://en.wikipedia.org/wiki/Cartesian_product)
  280. </details>
  281. ## Performance
  282. Braces is not only screaming fast, it's also more accurate the other brace expansion libraries.
  283. ### Better algorithms
  284. Fortunately there is a solution to the ["brace bomb" problem](#brace-matching-pitfalls): _don't expand brace patterns into an array when they're used for matching_.
  285. Instead, convert the pattern into an optimized regular expression. This is easier said than done, and braces is the only library that does this currently.
  286. **The proof is in the numbers**
  287. Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
  288. | **Pattern** | **braces** | **[minimatch](https://github.com/isaacs/minimatch)** |
  289. | --- | --- | --- |
  290. | `{1..9007199254740991}`<sup class="footnote-ref"><a href="#fn1" id="fnref1">[1]</a></sup> | `298 B` (5ms 459μs) | N/A (freezes) |
  291. | `{1..1000000000000000}` | `41 B` (1ms 15μs) | N/A (freezes) |
  292. | `{1..100000000000000}` | `40 B` (890μs) | N/A (freezes) |
  293. | `{1..10000000000000}` | `39 B` (2ms 49μs) | N/A (freezes) |
  294. | `{1..1000000000000}` | `38 B` (608μs) | N/A (freezes) |
  295. | `{1..100000000000}` | `37 B` (397μs) | N/A (freezes) |
  296. | `{1..10000000000}` | `35 B` (983μs) | N/A (freezes) |
  297. | `{1..1000000000}` | `34 B` (798μs) | N/A (freezes) |
  298. | `{1..100000000}` | `33 B` (733μs) | N/A (freezes) |
  299. | `{1..10000000}` | `32 B` (5ms 632μs) | `78.89 MB` (16s 388ms 569μs) |
  300. | `{1..1000000}` | `31 B` (1ms 381μs) | `6.89 MB` (1s 496ms 887μs) |
  301. | `{1..100000}` | `30 B` (950μs) | `588.89 kB` (146ms 921μs) |
  302. | `{1..10000}` | `29 B` (1ms 114μs) | `48.89 kB` (14ms 187μs) |
  303. | `{1..1000}` | `28 B` (760μs) | `3.89 kB` (1ms 453μs) |
  304. | `{1..100}` | `22 B` (345μs) | `291 B` (196μs) |
  305. | `{1..10}` | `10 B` (533μs) | `20 B` (37μs) |
  306. | `{1..3}` | `7 B` (190μs) | `5 B` (27μs) |
  307. ### Faster algorithms
  308. When you need expansion, braces is still much faster.
  309. _(the following results were generated using `braces.expand()` and `minimatch.braceExpand()`, respectively)_
  310. | **Pattern** | **braces** | **[minimatch](https://github.com/isaacs/minimatch)** |
  311. | --- | --- | --- |
  312. | `{1..10000000}` | `78.89 MB` (2s 698ms 642μs) | `78.89 MB` (18s 601ms 974μs) |
  313. | `{1..1000000}` | `6.89 MB` (458ms 576μs) | `6.89 MB` (1s 491ms 621μs) |
  314. | `{1..100000}` | `588.89 kB` (20ms 728μs) | `588.89 kB` (156ms 919μs) |
  315. | `{1..10000}` | `48.89 kB` (2ms 202μs) | `48.89 kB` (13ms 641μs) |
  316. | `{1..1000}` | `3.89 kB` (1ms 796μs) | `3.89 kB` (1ms 958μs) |
  317. | `{1..100}` | `291 B` (424μs) | `291 B` (211μs) |
  318. | `{1..10}` | `20 B` (487μs) | `20 B` (72μs) |
  319. | `{1..3}` | `5 B` (166μs) | `5 B` (27μs) |
  320. If you'd like to run these comparisons yourself, see [test/support/generate.js](test/support/generate.js).
  321. ## Benchmarks
  322. ### Running benchmarks
  323. Install dev dependencies:
  324. ```bash
  325. npm i -d && npm benchmark
  326. ```
  327. ### Latest results
  328. ```bash
  329. Benchmarking: (8 of 8)
  330. · combination-nested
  331. · combination
  332. · escaped
  333. · list-basic
  334. · list-multiple
  335. · no-braces
  336. · sequence-basic
  337. · sequence-multiple
  338. # benchmark/fixtures/combination-nested.js (52 bytes)
  339. brace-expansion x 4,756 ops/sec ±1.09% (86 runs sampled)
  340. braces x 11,202,303 ops/sec ±1.06% (88 runs sampled)
  341. minimatch x 4,816 ops/sec ±0.99% (87 runs sampled)
  342. fastest is braces
  343. # benchmark/fixtures/combination.js (51 bytes)
  344. brace-expansion x 625 ops/sec ±0.87% (87 runs sampled)
  345. braces x 11,031,884 ops/sec ±0.72% (90 runs sampled)
  346. minimatch x 637 ops/sec ±0.84% (88 runs sampled)
  347. fastest is braces
  348. # benchmark/fixtures/escaped.js (44 bytes)
  349. brace-expansion x 163,325 ops/sec ±1.05% (87 runs sampled)
  350. braces x 10,655,071 ops/sec ±1.22% (88 runs sampled)
  351. minimatch x 147,495 ops/sec ±0.96% (88 runs sampled)
  352. fastest is braces
  353. # benchmark/fixtures/list-basic.js (40 bytes)
  354. brace-expansion x 99,726 ops/sec ±1.07% (83 runs sampled)
  355. braces x 10,596,584 ops/sec ±0.98% (88 runs sampled)
  356. minimatch x 100,069 ops/sec ±1.17% (86 runs sampled)
  357. fastest is braces
  358. # benchmark/fixtures/list-multiple.js (52 bytes)
  359. brace-expansion x 34,348 ops/sec ±1.08% (88 runs sampled)
  360. braces x 9,264,131 ops/sec ±1.12% (88 runs sampled)
  361. minimatch x 34,893 ops/sec ±0.87% (87 runs sampled)
  362. fastest is braces
  363. # benchmark/fixtures/no-braces.js (48 bytes)
  364. brace-expansion x 275,368 ops/sec ±1.18% (89 runs sampled)
  365. braces x 9,134,677 ops/sec ±0.95% (88 runs sampled)
  366. minimatch x 3,755,954 ops/sec ±1.13% (89 runs sampled)
  367. fastest is braces
  368. # benchmark/fixtures/sequence-basic.js (41 bytes)
  369. brace-expansion x 5,492 ops/sec ±1.35% (87 runs sampled)
  370. braces x 8,485,034 ops/sec ±1.28% (89 runs sampled)
  371. minimatch x 5,341 ops/sec ±1.17% (87 runs sampled)
  372. fastest is braces
  373. # benchmark/fixtures/sequence-multiple.js (51 bytes)
  374. brace-expansion x 116 ops/sec ±0.77% (77 runs sampled)
  375. braces x 9,445,118 ops/sec ±1.32% (84 runs sampled)
  376. minimatch x 109 ops/sec ±1.16% (76 runs sampled)
  377. fastest is braces
  378. ```
  379. ## About
  380. <details>
  381. <summary><strong>Contributing</strong></summary>
  382. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  383. </details>
  384. <details>
  385. <summary><strong>Running Tests</strong></summary>
  386. 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:
  387. ```sh
  388. $ npm install && npm test
  389. ```
  390. </details>
  391. <details>
  392. <summary><strong>Building docs</strong></summary>
  393. _(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.)_
  394. To generate the readme, run the following command:
  395. ```sh
  396. $ npm install -g verbose/verb#dev verb-generate-readme && verb
  397. ```
  398. </details>
  399. ### Related projects
  400. You might also be interested in these projects:
  401. * [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.")
  402. * [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.")
  403. * [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`")
  404. * [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.")
  405. * [nanomatch](https://www.npmjs.com/package/nanomatch): Fast, minimal glob matcher for node.js. Similar to micromatch, minimatch and multimatch, but complete Bash… [more](https://github.com/micromatch/nanomatch) | [homepage](https://github.com/micromatch/nanomatch "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)")
  406. ### Contributors
  407. | **Commits** | **Contributor** |
  408. | --- | --- |
  409. | 188 | [jonschlinkert](https://github.com/jonschlinkert) |
  410. | 4 | [doowb](https://github.com/doowb) |
  411. | 1 | [es128](https://github.com/es128) |
  412. | 1 | [eush77](https://github.com/eush77) |
  413. | 1 | [hemanth](https://github.com/hemanth) |
  414. ### Author
  415. **Jon Schlinkert**
  416. * [linkedin/in/jonschlinkert](https://linkedin.com/in/jonschlinkert)
  417. * [github/jonschlinkert](https://github.com/jonschlinkert)
  418. * [twitter/jonschlinkert](https://twitter.com/jonschlinkert)
  419. ### License
  420. Copyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).
  421. Released under the [MIT License](LICENSE).
  422. ***
  423. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on February 17, 2018._
  424. <hr class="footnotes-sep">
  425. <section class="footnotes">
  426. <ol class="footnotes-list">
  427. <li id="fn1" class="footnote-item">this is the largest safe integer allowed in JavaScript. <a href="#fnref1" class="footnote-backref"></a>
  428. </li>
  429. </ol>
  430. </section>