* Determines whether a value should be treated as a promise. * Any object whose "then" property is a function will be considered a promise. * * @param {?} value The value to test. * @return {boolean} Whether the value is a promise.
(value)
| 34 | * @return {boolean} Whether the value is a promise. |
| 35 | */ |
| 36 | function isPromise(value) { |
| 37 | try { |
| 38 | // Use array notation so the Closure compiler does not obfuscate away our |
| 39 | // contract. |
| 40 | return (typeof value === 'object' || typeof value === 'function') && typeof value['then'] === 'function' |
| 41 | /*eslint no-unused-vars: "off"*/ |
| 42 | } catch (ex) { |
| 43 | return false |
| 44 | } |
| 45 | } |
| 46 | |
| 47 | module.exports = { |
| 48 | isObject, |
nothing calls this directly
no outgoing calls
no test coverage detected