-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added method to get an iterator for all files in HasteFS #7010
Added method to get an iterator for all files in HasteFS #7010
Conversation
@@ -44,6 +44,10 @@ export default class HasteFS { | |||
return Array.from(this._files.keys()); | |||
} | |||
|
|||
getFileIterator(): Iterator<string> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rafeca you'll be able to use this in Metro. It should be way faster if you just want to iterate over the files.
Changelog? 😀 |
Codecov Report
@@ Coverage Diff @@
## master #7010 +/- ##
==========================================
+ Coverage 66.94% 66.95% +<.01%
==========================================
Files 250 250
Lines 10401 10404 +3
Branches 4 3 -1
==========================================
+ Hits 6963 6966 +3
Misses 3437 3437
Partials 1 1
Continue to review full report at Codecov.
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This method is faster if the consumer only want to traverse the files (no need to create a new array). It is especially relevant if the number of files in the map is large.
Test plan
Only flow typechecking. This file isn't unit tested, but the code is so simple it doesn't really need it. Manually tested in the terminal.
Edit: tested through jest-resolve-dependencies, where it's used now