collection.js
function each(collection, iterator, context) {
  var i = 0;

  if ('array' === type(collection)) {
    for (; i < collection.length; i++) {
      if (false === iterator.call(context || iterator, collection[i], i, collection)) {
        return; // If false is returned by the callback we need to bail out.
      }
    }
  } else {
    for (i in collection) {
      if (hasOwn.call(collection, i)) {
        if (false === iterator.call(context || iterator, collection[i], i, collection)) {
          return; // If false is returned by the callback we need to bail out.
        }
      }
    }
  }
}
function each(collection, iterator, context) {
  var i = 0;

  if ('array' === type(collection)) {
    for (; i < collection.length; i++) {
      if (false === iterator.call(context || iterator, collection[i], i, collection)) {
        return; // If false is returned by the callback we need to bail out.
      }
    }
  } else {
    for (i in collection) {
      if (hasOwn.call(collection, i)) {
        if (false === iterator.call(context || iterator, collection[i], i, collection)) {
          return; // If false is returned by the callback we need to bail out.
        }
      }
    }
  }
}
function each ( collection , iterator , context ) { var i = 0 ; if ( 'array' === type ( collection ) ) { for ( ; i < collection . length ; i ++ ) { if ( false === iterator . call ( context || iterator , collection [ i ] , i , collection ) ) { return ; // If false is returned by the callback we need to bail out. } } } else { for ( i in collection ) { if ( hasOwn . call ( collection , i ) ) { if ( false === iterator . call ( context || iterator , collection [ i ] , i , collection ) ) { return ; // If false is returned by the callback we need to bail out. } } } } }
Iterate over a collection.

@param {Mixed} collection The object we want to iterate over.
@param {Function} iterator The function that's called for each iteration.
@param {Mixed} context The context of the function.
@api public
Iterate over a collection .