Files
angular.js/lib/promises-aplus/promises-aplus-test-adapter.js
Shahar Talmi e6ebfc87c9 refactor(Angular): add isPromiseLike helper function
This can be used internally to remove the repeating pattern of `obj && obj.then`. For now, I don't see a good reason to expose this in angular's public interface.

Conflicts:
	src/Angular.js
2014-07-22 16:35:02 -07:00

20 lines
538 B
JavaScript

/* global qFactory: false */
'use strict';
var isFunction = function isFunction(value){return typeof value == 'function';};
var isPromiseLike = function isPromiseLike(obj) {return obj && isFunction(obj.then);};
var $q = qFactory(process.nextTick, function noopExceptionHandler() {});
exports.fulfilled = $q.resolve;
exports.rejected = $q.reject;
exports.pending = function () {
var deferred = $q.defer();
return {
promise: deferred.promise,
fulfill: deferred.resolve,
reject: deferred.reject
};
};