# Code coverage report for lib/utils/async.js

## Statements: 90.91% (10 / 11) Branches: 66.67% (4 / 6) Functions: 100% (3 / 3) Lines: 100% (9 / 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

    2
    2

    2
    2
    2
    2
    2
    2

     module.exports = {

      /**
       */

      each: function(items, each, complete) {

        var total     = items.length;
        var completed = 0;

        items.forEach(function(item) {
          var called = false;
          each(item, function() {
            Iif (called) throw new Error("callback called twice");
            called = true;
            Eif (++completed === total && complete) complete();
          });
        });
      }
    };