Skip to content

Commit 3f36436

Browse files
committed
Use stricter Promise check
1 parent 15b2af3 commit 3f36436

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

Diff for: package.json

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"inherits": "2.0.3",
2929
"is-arguments": "^1.0.4",
3030
"is-generator-function": "^1.0.7",
31-
"is-promise": "^2.1.0",
3231
"object.entries": "^1.1.0",
3332
"safe-buffer": "^5.1.2"
3433
},

Diff for: support/types.js

+16-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ var isBuffer = require('./isBuffer');
77

88
var isArgumentsObject = require('is-arguments');
99
var isGeneratorFunction = require('is-generator-function');
10-
var isPromise = require('is-promise');
1110

1211
function uncurryThis(f) {
1312
return f.call.bind(f);
@@ -59,6 +58,22 @@ exports.isArgumentsObject = isArgumentsObject;
5958

6059
exports.isGeneratorFunction = isGeneratorFunction;
6160

61+
// Taken from here and modified for better browser support
62+
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
63+
function isPromise(input) {
64+
return (
65+
(
66+
typeof Promise !== 'undefined' &&
67+
input instanceof Promise
68+
) ||
69+
(
70+
input !== null &&
71+
typeof input === 'object' &&
72+
typeof input.then === 'function' &&
73+
typeof input.catch === 'function'
74+
)
75+
);
76+
}
6277
exports.isPromise = isPromise;
6378

6479
function isArrayBufferView(value) {

0 commit comments

Comments
 (0)