caolan/async — pull request #264 by kadishmal (2013-03-11 01:10:42+00:00)
Title: add eachIndex/forEachIndex function with tests

I've added a new function `eachIndex` with `forEachIndex` alias that does exactly what `each` function does. The difference is in the number of arguments the iterators accept.

function eachIterator(val, callback) {...}
function eachIndexIterator(val, index, callback) {...}

The iterator for `eachIndex` accepts additional `index` argument which indicates on the index in the array that `val` is.

This functionality was necessary for me when I needed to distinguish the values of the supplied array based on their position in the array.

I hope this function will be useful for others as well.