Last active
October 23, 2015 08:33
-
-
Save davibe/72709011e30550981415 to your computer and use it in GitHub Desktop.
What does this Q.each function do ? How could you use it ?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Q = require 'q' | |
Q.each = (collection, iterator) -> | |
cur = Q() | |
promises = collection.map (item) -> | |
cur = cur.then -> | |
iterator(item) | |
Q.all(promises) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please do not leave comments or answers here. Answer by e-mail.