cowboy/javascript-sync-async-foreach — Issue #1: Add sparse array support like a boss.
Author: jdalton
Created: 2011-11-11 20:10:37+00:00
State: open

For extra bonus points you should make this method closer to the [ES5.1 one](http://es5.github.com/#x15.4.4.18).
So this:

~~~ js
forEach(arr, eachFn, doneFn)
~~~

would become

~~~
forEach(object, callback [, options]);
~~~

`options` would have callback params like `onDone` as well as a `bound` prop or something.

Also, internally you should resolve length like `var length = object.length >>> 0;` and support sparse arrays *(`in` operator checks)*.

I have a method similar to this in [benchmark.js](https://github.com/bestiejs/benchmark.js/blob/master/benchmark.js#L934-971) *(also allows async calling)*.