From c2c32916363d84736d3655da46bc36212cf51e25 Mon Sep 17 00:00:00 2001 From: zsh Date: Mon, 28 Oct 2019 16:22:52 +0800 Subject: [PATCH] update isPromise function --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index aacf6ef..542fb77 100644 --- a/index.js +++ b/index.js @@ -196,7 +196,7 @@ function objectToPromise(obj){ */ function isPromise(obj) { - return 'function' == typeof obj.then; + return !!obj && (typeof obj === 'object' && obj.__proto__ === Promise.prototype) } /**