This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Multiple Different Implementations of isPromiseLike() #13372
Open
Description
promises-aplus-test-adapter uses the following code to determine if an object is promise-like:
var isPromiseLike = function isPromiseLike(obj) {return obj && isFunction(obj.then);};
ngAnimate does this:
var isPromiseLike = function(p) {
return p && p.then ? true : false;
};
and Angular.js does this:
function isPromiseLike(obj) {
return obj && isFunction(obj.then);
}
Perhaps they should all be changed to this:
function isPromiseLike(obj) {
return obj && typeof obj.then === 'function';
}