-
Notifications
You must be signed in to change notification settings - Fork 89
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
use forIn or forEach instead of map #51
Comments
Hi @GhostThrone and thanks for bringing this issue up. Can you collaborate a bit further? What is the benefit of Also what you mean by |
I think what he meant is that this functions mutate something out of their scope, and you aren't using the map to actually map and return new values, you are using it to iterate through an array to mutate something. IMO forEach is more semantic in this case because it clearly states you want to iterate this array to mutate something, but i wouldn't say this is a "wrong usage of map", you could test the performance to see if it makes a difference, if it doesn't than it's just a minor semantic issue :) |
@MarcoWorms Thanks for the clarification. It makes sense. I will do the benchmark and see if a change is required or not. |
Benchmark showed that In The change is published in the new version 1.0.5 and I am closing the issue. |
forEach also has access to key and value |
Right, right :) I never use the method and I checked MDN docs for it and I read only the example where key is not showed. My mistake - next version will address changing |
@MarcoWorms Thanks. |
Hi guys.
I was checking source code and i found that "map" function is used incorrectly. For that case i advise to use "forIn" or "forEach" instead.
Lines where i found that:
rambda/modules/lastIndexOf.js
Line 9 in e12c551
rambda/modules/equals.js
Line 33 in e12c551
Thanks for this library and for your job.
Greetings ✋
The text was updated successfully, but these errors were encountered: