Looking at line 248 in the source for $ q ( https://github.com/angular/angular.js/blob/master/src/ng/q.js#L248 ), you really can't check what you can do it is definitely. It will be your best choice.
var deferred = method();
if(angular.isObject(deferred) &&
angular.isObject(deferred.promise) &&
deferred.promise.then instanceof Function &&
deferred.promise["catch"] instanceof Function &&
deferred.promise["finally"] instanceof Function){
}
, new Promise(), promise instanceof Promise, , , , , .
"HttpPromise", error success, $http (https://github.com/angular/angular.js/blob/master/src/ng/http.js#L726):
var promise = $http(...);
if(angular.isObject(promise) &&
promise.then instanceof Function &&
promise["catch"] instanceof Function &&
promise["finally"] instanceof Function &&
promise.error instanceof Function &&
promise.success instanceof Function){
}
EXTRA
, $HTTP deferred, , , $q.when(...) , . , $q.when deferred, $q.deferred().promise, $http(...) $q.deferred()
, , , , :
TypeError: Expecting a function in instanceof check, but got #<Object>