fix: handle single-character fromRegExp patterns - #3877
Conversation
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## next #3877 +/- ##
==========================================
- Coverage 98.92% 98.84% -0.09%
==========================================
Files 908 908
Lines 3159 3193 +34
Branches 581 591 +10
==========================================
+ Hits 3125 3156 +31
- Misses 30 33 +3
Partials 4 4
🚀 New features to boost your workflow:
|
|
This will cause a merge conflict with #3857 So this may take far longer than usual to merge. |
ST-DDT
left a comment
There was a problem hiding this comment.
This PR only makes the existing rudementary tests green, it does not really implement the feature.
faker.helpers.fromRegExp(/./) // "8"
faker.helpers.fromRegExp(/../) // ".." ❌
faker.helpers.fromRegExp(/w/i) // "W"
faker.helpers.fromRegExp(/ww/i) // "ww" ❌🏴 BAD-QUALITY: Please ensure PRs are reviewed for quality by humans before submission.
|
Fixed in d0f1503. The implementation now scans remaining unquantified regex tokens after stripping anchors, replacing repeated wildcard dots like |
ST-DDT
left a comment
There was a problem hiding this comment.
There is one issue with the current implementation of the fromRegExp method.
It basically repeats parts of the implementation over and over.
First for unquantified, then for quantified, then for ranges, ...
It fixes the todo, so I think it is an improvement, but it might be worth refactoring/re-implementing it eventually.
Summary
Validation