docs: function(promises, callback) {
          function _checkComplete() {
              if (successfulPromises.length + failedPromises.length === count) {
                  if (typeof callback === 'function') {
                      callback(successfulPromises, failedPromises);
                  }
              }
          };
  
          var successfulPromises = [];
          var failedPromises = [];
  
          if (promises instanceof Array) {
              var count = promises.length;
              if(count === 0) {
                  // There are no promises. Just resolve and return.
                  _checkComplete();
                  return;
              }
  
              promises.forEach(function(item) {
                  // Register a callback to track all successful and failed 
                  // promises.
                  item.success(function() {
                      successfulPromises.push(item);
                      _checkComplete();
                  });
                  item.fail(function() {
                      failedPromises.push(item);
                      _checkComplete();
                  });
              });
          } else {
              throw 'Invalid argument: promises. Must be an array';
          }
      }