-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Can you add the index of array in async.forEach and async.forEachSeries? #213
Comments
sorry)))) forgot about indexOf... |
This should be closed as a duplicate of #168 |
@llevkin see my comments on function arity in #168 - further discussion on this should happen there. Thanks @brianmaissy, I'll close this one. |
there is an issue where you have 2 identical rows and the indexOf will throw a wrong index.... would be so much usefull to have and index iterator in the function.. |
|
I came across this today, which I think is absolutely brilliant...in case you are needing the ID.
|
Now async.forEach and async.forEachSeries looks like this:
async.forEachSeries(array, iterator, callback);
iterator has two arguments:
function iterator(item, callback) {}
If I need find a key (index) of item in array by value, how i can get it?
For async.forEachSeries I can declare my own varable count and increment it in the end of iterator-function, I think it not quite right, but it's possible.. For async.forEach function it's not possible to detect a key (index) of array value...( For example, how I can remove some items from array with async, if i don't know a key of value?
Maybe it makes sense to add in iterator function a third argument key (index)? Somthing like this:
function iterator(item, callback, key) {} - it's not so beauty, but useful.
Great Regards! sorry for my English.
The text was updated successfully, but these errors were encountered: