feat(facade): add support for all thenables (#10278)

All objects that have a then function will be considered Promises
This commit is contained in:
Gabe Johnson
2016-07-27 12:37:48 -05:00
committed by Victor Berchet
parent 9d9e9c6ff1
commit 58d9e7fc5a
2 changed files with 22 additions and 2 deletions

View File

@ -133,7 +133,9 @@ export function isStrictStringMap(obj: any): boolean {
}
export function isPromise(obj: any): boolean {
return obj instanceof (<any>_global).Promise;
// allow any Promise/A+ compliant thenable.
// It's up to the caller to ensure that obj.then conforms to the spec
return isPresent(obj) && isFunction(obj.then);
}
export function isArray(obj: any): boolean {