dist/scripts/vendor.min.js
function when(value, callback, errback, progressBack) {
    var result = new Promise();
    resolvePromise(result, value);
    return result.then(callback, errback, progressBack);
  }
function when(value, callback, errback, progressBack) {
    var result = new Promise();
    resolvePromise(result, value);
    return result.then(callback, errback, progressBack);
  }
@ngdoc method
@name $q#when
@kind function

@description
Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
This is useful when you are dealing with an object that might or might not be a promise, or if
the promise comes from a source that can't be trusted.

@param {*} value Value or a promise
@param {Function=} successCallback
@param {Function=} errorCallback
@param {Function=} progressCallback
@returns {Promise} Returns a promise of the passed value or promise