This repository was archived by the owner on Nov 21, 2025. It is now read-only.
Commit 0791852
Update example to use correct Regexp (#1300)
`[w-]*` means to match `w` character literally or `-` character, zero or unlimited times.
So now this Regex is matching everything that endsWith `.ts` or `.tsx`, even a file with empty filename.
If this is intended, so the first parti of the regular expression is completely useless. Otherwise we could be more strict on this (since we are speaking of an example, of course)
Moreover the capturing group around `(js|jsx|ts|tsx)` is not needed since it's unused inside a `.test` method and it's heavier than `(?:j|t)sx?
This new regex does exactly half of the steps than before.
*Before*: 85 steps
*After*: 21 steps1 parent 87cb335 commit 0791852
1 file changed
Lines changed: 1 addition & 1 deletion
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
51 | 51 | | |
52 | 52 | | |
0 commit comments