🎨 Support non-native promises

This commit is contained in:
cdaringe 2016-05-24 23:38:35 -06:00
parent 4cd0de0e87
commit 32073fa079
No known key found for this signature in database
GPG key ID: 8C3201E7E66E08D0
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
)
}