whole_func_string: function race(promises) {
      var deferred = defer();
  
      forEach(promises, function(promise) {
        when(promise).then(deferred.resolve, deferred.reject);
      });
  
      return deferred.promise;
    }
func_code_string: function race(promises) {
      var deferred = defer();
  
      forEach(promises, function(promise) {
        when(promise).then(deferred.resolve, deferred.reject);
      });
  
      return deferred.promise;
    }
func_documentation_string: @ngdoc method
  @name $q#race
  @kind function
  
  @description
  Returns a promise that resolves or rejects as soon as one of those promises
  resolves or rejects, with the value or reason from that promise.
  
  @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
  @returns {Promise} a promise that resolves or rejects as soon as one of the `promises`
  resolves or rejects, with the value or reason from that promise.