docs: function(resolvedCallback, rejectedCallback) {
        var promise = new Parse.Promise();
  
        var wrappedResolvedCallback = function() {
          var result = arguments;
          if (resolvedCallback) {
            result = [resolvedCallback.apply(this, result)];
          }
          if (result.length === 1 && Parse.Promise.is(result[0])) {
            result[0].then(function() {
              promise.resolve.apply(promise, arguments);
            }, function(error) {
              promise.reject(error);
            });
          } else {
            promise.resolve.apply(promise, result);
          }
        };
  
        var wrappedRejectedCallback = function(error) {
          var result = [];
          if (rejectedCallback) {
            result = [rejectedCallback(error)];
            if (result.length === 1 && Parse.Promise.is(result[0])) {
              result[0].then(function() {
                promise.resolve.apply(promise, arguments);
              }, function(error) {
                promise.reject(error);
              });
            } else {
              // A Promises/A+ compliant implementation would call:
              // promise.resolve.apply(promise, result);
              promise.reject(result[0]);
            }
          } else {
            promise.reject(error);
          }
        };
  
        if (this._resolved) {
          wrappedResolvedCallback.apply(this, this._result);
        } else if (this._rejected) {
          wrappedRejectedCallback(this._error);
        } else {
          this._resolvedCallbacks.push(wrappedResolvedCallback);
          this._rejectedCallbacks.push(wrappedRejectedCallback);
        }
  
        return promise;
      }