docs: function(promises) {
        // Allow passing in Promises as separate arguments instead of an Array.
        var objects;
        if (promises && Parse._isNullOrUndefined(promises.length)) {
          objects = arguments;
        } else {
          objects = promises;
        }
  
        var total = objects.length;
        var hadError = false;
        var results = [];
        var errors = [];
        results.length = objects.length;
        errors.length = objects.length;
  
        if (total === 0) {
          return Parse.Promise.as.apply(this, results);
        }
  
        var promise = new Parse.Promise();
  
        var resolveOne = function() {
          total = total - 1;
          if (total === 0) {
            if (hadError) {
              promise.reject(errors);
            } else {
              promise.resolve.apply(promise, results);
            }
          }
        };
  
        Parse._arrayEach(objects, function(object, i) {
          if (Parse.Promise.is(object)) {
            object.then(function(result) {
              results[i] = result;
              resolveOne();
            }, function(error) {
              errors[i] = error;
              hadError = true;
              resolveOne();
            });
          } else {
            results[i] = object;
            resolveOne();
          }
        });
  
        return promise;
      }