src/Parse.js
function wrapParsePromise(promise, parsePromise) {
      ['_rejected', '_rejectedCallbacks', '_resolved', '_resolvedCallbacks', '_result', 'reject', 'resolve']
        .forEach(function (prop) {
          promise[prop] = parsePromise[prop];
        });

      ['_continueWith', '_thenRunCallbacks', 'always', 'done', 'fail'].forEach(function (method) {
        promise[method] = wrap(parsePromise[method]);
      });

      ['then', 'catch'].forEach(function (method) {
        var func = promise[method];
        promise[method] = function wrappedAngularPromise() {
          var args = Array.prototype.slice.call(arguments, 0);
          var promise = func.apply(this, args);
          wrapParsePromise(promise, parsePromise);
          return promise;
        };
      });

      return promise;
    }
function wrapParsePromise(promise, parsePromise) {
      ['_rejected', '_rejectedCallbacks', '_resolved', '_resolvedCallbacks', '_result', 'reject', 'resolve']
        .forEach(function (prop) {
          promise[prop] = parsePromise[prop];
        });

      ['_continueWith', '_thenRunCallbacks', 'always', 'done', 'fail'].forEach(function (method) {
        promise[method] = wrap(parsePromise[method]);
      });

      ['then', 'catch'].forEach(function (method) {
        var func = promise[method];
        promise[method] = function wrappedAngularPromise() {
          var args = Array.prototype.slice.call(arguments, 0);
          var promise = func.apply(this, args);
          wrapParsePromise(promise, parsePromise);
          return promise;
        };
      });

      return promise;
    }
function wrapParsePromise ( promise , parsePromise ) { [ '_rejected' , '_rejectedCallbacks' , '_resolved' , '_resolvedCallbacks' , '_result' , 'reject' , 'resolve' ] . forEach ( function ( prop ) { promise [ prop ] = parsePromise [ prop ] ; } ) ; [ '_continueWith' , '_thenRunCallbacks' , 'always' , 'done' , 'fail' ] . forEach ( function ( method ) { promise [ method ] = wrap ( parsePromise [ method ] ) ; } ) ; [ 'then' , 'catch' ] . forEach ( function ( method ) { var func = promise [ method ] ; promise [ method ] = function wrappedAngularPromise ( ) { var args = Array . prototype . slice . call ( arguments , 0 ) ; var promise = func . apply ( this , args ) ; wrapParsePromise ( promise , parsePromise ) ; return promise ; } ; } ) ; return promise ; }
Wraps Promise.

@param {Object} promise
@param {Object} parsePromise
@returns {Object}
Wraps Promise .