You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+90-97
Original file line number
Diff line number
Diff line change
@@ -20,15 +20,15 @@ See the [changelog](CHANGELOG.md) for details.
20
20
21
21
Brace patterns make globs more powerful by adding the ability to match specific ranges and sequences of characters.
22
22
23
-
***Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
24
-
***[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
25
-
***Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
26
-
***Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
27
-
***Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
*[Supports escaping](#escaping) - To prevent evaluation of special characters.
23
+
-**Accurate** - complete support for the [Bash 4.3 Brace Expansion](www.gnu.org/software/bash/) specification (passes all of the Bash braces tests)
24
+
-**[fast and performant](#benchmarks)** - Starts fast, runs fast and [scales well](#performance) as patterns increase in complexity.
25
+
-**Organized code base** - The parser and compiler are easy to maintain and update when edge cases crop up.
26
+
-**Well-tested** - Thousands of test assertions, and passes all of the Bash, minimatch, and [brace-expansion](https://github.com/juliangruber/brace-expansion) unit tests (as of the date this was written).
27
+
-**Safer** - You shouldn't have to worry about users defining aggressive or malicious brace patterns that can break your application. Braces takes measures to prevent malicious regex that can be used for DDoS attacks (see [catastrophic backtracking](https://www.regular-expressions.info/catastrophic.html)).
**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.
184
184
185
185
```js
186
-
console.log(braces('a/{b,c}/d', { maxLength:3 })); //=> throws an error
186
+
console.log(braces('a/{b,c}/d', { maxLength:3 })); //=> throws an error
@@ -313,8 +313,8 @@ Brace expansion is a type of parameter expansion that was made popular by unix s
313
313
314
314
In addition to "expansion", braces are also used for matching. In other words:
315
315
316
-
*[brace expansion](#brace-expansion) is for generating new lists
317
-
*[brace matching](#brace-matching) is for filtering existing lists
316
+
-[brace expansion](#brace-expansion) is for generating new lists
317
+
-[brace matching](#brace-matching) is for filtering existing lists
318
318
319
319
<details>
320
320
<summary><strong>More about brace expansion</strong> (click to expand)</summary>
@@ -394,9 +394,9 @@ Although brace patterns offer a user-friendly way of matching ranges or sets of
394
394
395
395
**"brace bombs"**
396
396
397
-
* brace expansion can eat up a huge amount of processing resources
398
-
* as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
399
-
* users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
397
+
- brace expansion can eat up a huge amount of processing resources
398
+
- as brace patterns increase _linearly in size_, the system resources required to expand the pattern increase exponentially
399
+
- users can accidentally (or intentially) exhaust your system's resources resulting in the equivalent of a DoS attack (bonus: no programming knowledge is required!)
400
400
401
401
For a more detailed explanation with examples, see the [geometric complexity](#geometric-complexity) section.
402
402
@@ -418,8 +418,8 @@ For example, the following sets demonstrate quadratic (`O(n^2)`) complexity:
418
418
But add an element to a set, and we get a n-fold Cartesian product with `O(n^c)` complexity:
@@ -456,25 +456,25 @@ Instead, convert the pattern into an optimized regular expression. This is easie
456
456
457
457
Minimatch gets exponentially slower as patterns increase in complexity, braces does not. The following results were generated using `braces()` and `minimatch.braceExpand()`, respectively.
0 commit comments