angular/angular.js — pull request #6775 by carlosV2 (2014-03-20 15:57:12+00:00)
Title: Added the 'whileEach' function

Invokes the `iterator` function once for each item in `obj` collection, which can be either an object or an array until any value is returned or the end of the collection. The `iterator` function is invoked with `iterator(value, key)`, where `value` is the value of an object property or an array element and `key` is the object property key or array element index. Specifying a `context` for the function is optional.

Example:
var values = [
{name: 'sandra', gender: 'female'},
{name: 'carlos', gender: 'male'},
{name: 'wally', gender: 'male'},
{name: 'john', gender: 'male'}
];
var gender = angular.whileEach(values, function(value, key){
if (value.name === 'wally') {
return value.gender;
}
}, undefined, 'not found');
expect(gender).toEqual('male');

Carlos