caolan/async — pull request #158 by rektide (2012-08-01 01:13:44+00:00)
Title: An array which grows never completed a forEach

Patch and implementation to allow async.forEach to complete even if the array grows in size.

There is an alternative implementation rektide@3eda64242c5557ce2f4ee9809a0f7a8fe9af4473 that avoids this somewhat-hackish recursion (and the cost of building & storing additional state): it does, however, not make use of _forEach, & I was not sure what costs are associated with not using native Array.forEach when it is available.

Either that implementation, or this rektide@76db4aff3daa22e8149c05db793ad05aa9e01d50 implementation, both resolve the issue, which is demonstrated in the test.