mbostock/queue — pull request #14 by ricardobeat (2013-04-06 02:54:12+00:00)
Title: Add queue.map() and tests

Using a loop to add tasks breaks chaining and mandates saving the queue to a variable, making it unnecessarily complex. I had to pull out an external helper:

asyncMap = (q, fn, items) -> q.defer(fn, item) for item in items; q

This pull is a more complete implementation, similar to `.deferAll` at #8. I've read the discussion and I don't think any magic needs to be done with the arguments, you can achieve anything using `bind/apply/call`.

Related question: why doesn't queue use a constructor/prototype? It's completely opaque ATM, impossible to extend. That might also bring performance gains.