-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Transformed all remaining occurences of for..of to forEach() #426
Transformed all remaining occurences of for..of to forEach() #426
Conversation
fixes #415? |
if (name !== 'default') { | ||
for (let dep of this.dependencies.values()) { | ||
let innerMap = dep() | ||
this.dependencies.forEach((dep) => { |
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.
this would ideally be a some
so that it short-circuits. not sure how to achieve with a Set
...
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.
I learned while doing this that Maps
and Sets
are very fundamentally not Arrays
. So, no some
and not even a clear way to utilize the basic for
statement and break out of it (i.e. you can't access them in an indexed fashion).
I suspect the overhead of converting to an array just to use some would be greater than the gain.
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.
After thinking about this some,,, I may experiment with directly accessing the iterator in a for loop. This is essentially what is going on with for..of, but I might be able to get away with it if I don't involve the underlying Symbol type and go directly to the Map / Set.
I've also realized I might have changed more than I had too. The instances that definitely caused problems involved using for..of to iterate Maps. In response, I changed all occurrences of for..of. It is possible that using for..of to iterate a Set causes no issue.
Yes. Didn't put that in the comment because I was merging into the branch I have to apologize for what it does to your code. I really wish I knew how On Thu, Jul 7, 2016 at 1:15 PM, Ben Mosher notifications@github.com wrote:
|
if (innerValue.found) { | ||
innerValue.path.unshift(this) | ||
return innerValue | ||
this.dependencies.forEach((dep) => { |
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.
same here, ideally would short-circuit
On short-circuits: I think you're probably right, best to leave it be. Though notably, FWIW, I'll probably revert to the I'm just over-thinking it. |
I'll go ahead and merge as-is if it fixes #415, no need to sweat the style stuff ATM. |
Thank you very much for accepting this. And I'd absolutely agree with reverting to |
No description provided.