Permalink
Browse files

some docblocks

  • Loading branch information...
1 parent a8fef8b commit 070655b7306d54bc5b5e09f58aff765c1f2df354 @naholyr committed May 16, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 lib/async.js
View
@@ -1,3 +1,12 @@
+/**
+ * Executes async function on a list of items, and executes passed callback only when all async calls are finished, or as soon
+ * as one call failed. One fail breaks the whole chain, and you won't get the other results.
+ *
+ * @param Array items The list of items to call async function on.
+ * @param Function exec The async function to be called on each item.
+ * @param Function execCallback The callback called by exec, but without the "error" first parameter (as it can't be erronous at this point).
+ * @param Function finalCallback The callback we call when all execs are done. It expects only one parameter (error).
+ */
exports.map = function map(items, exec, execCallback, finalCallback) {
var error = undefined;
var done = 0;

0 comments on commit 070655b

Please sign in to comment.