Merge pull request #5689 from cdaringe/master

Support non-native promises
This commit is contained in:
Cheng Zhao 2016-05-26 04:49:40 +00:00
commit 8a4b7eb062
5 changed files with 24 additions and 4 deletions

View file

@ -43,6 +43,11 @@ exports.defineProperties = function (exports) {
get: function () {
return require('../deprecations')
}
},
isPromise: {
get: function () {
return require('../is-promise')
}
}
})
}

View file

@ -0,0 +1,14 @@
'use strict'
module.exports = function isPromise (val) {
return (
val &&
val.then &&
val.then instanceof Function &&
val.constructor &&
val.constructor.reject &&
val.constructor.reject instanceof Function &&
val.constructor.resolve &&
val.constructor.resolve instanceof Function
)
}