Skip to content

Instantly share code, notes, and snippets.

@davibe
Last active October 23, 2015 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davibe/72709011e30550981415 to your computer and use it in GitHub Desktop.
Save davibe/72709011e30550981415 to your computer and use it in GitHub Desktop.
What does this Q.each function do ? How could you use it ?
Q = require 'q'
Q.each = (collection, iterator) ->
cur = Q()
promises = collection.map (item) ->
cur = cur.then ->
iterator(item)
Q.all(promises)
@davibe
Copy link
Author

davibe commented Oct 23, 2015

Please do not leave comments or answers here. Answer by e-mail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment