Skip to content

Commit

Permalink
Fix braces pattern to support more than 2 choices
Browse files Browse the repository at this point in the history
  • Loading branch information
amitdahan committed Jan 9, 2022
1 parent a9247f9 commit 92a7fcb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/utils/pattern.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ describe('Utils → Pattern', () => {
assert.ok(util.isDynamicPattern('{a,}'));
assert.ok(util.isDynamicPattern('{,b}'));
assert.ok(util.isDynamicPattern('{a,b}'));
assert.ok(util.isDynamicPattern('{a,b,c}'));
assert.ok(util.isDynamicPattern('{a' + ','.repeat(999999) + 'b}'));
assert.ok(util.isDynamicPattern('{1..3}'));
});

Expand Down
2 changes: 1 addition & 1 deletion src/utils/pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const COMMON_GLOB_SYMBOLS_RE = /[*?]|^!/;
const REGEX_CHARACTER_CLASS_SYMBOLS_RE = /\[[^[]*]/;
const REGEX_GROUP_SYMBOLS_RE = /(?:^|[^!*+?@])\([^(]*\|[^|]*\)/;
const GLOB_EXTENSION_SYMBOLS_RE = /[!*+?@]\([^(]*\)/;
const BRACE_EXPANSIONS_SYMBOLS_RE = /{[^,.{]*(?:,|\.\.)[^,.{]*}/;
const BRACE_EXPANSIONS_SYMBOLS_RE = /{[^,.{]*(?:,|\.\.).*[^,.{]*}/;

type PatternTypeOptions = {
braceExpansion?: boolean;
Expand Down

0 comments on commit 92a7fcb

Please sign in to comment.