Code coverage report for lib/utils/async.js

Statements: 9.09% (1 / 11)      Branches: 0% (0 / 6)      Functions: 0% (0 / 3)      Lines: 11.11% (1 / 9)      Ignored: none     

All files » lib/utils/ » async.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211                                        
module.exports = {
 
  /**
   */
 
  each: function(items, each, complete) {
 
    var total     = items.length;
    var completed = 0;
 
    items.forEach(function(item) {
      var called = false;
      each(item, function() {
        if (called) throw new Error("callback called twice");
        called = true;
        if (++completed === total && complete) complete();
      });
    });
  }
};