Skip to content

Commit

Permalink
Use stricter Promise check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukechilds committed Apr 30, 2019
1 parent 15b2af3 commit 3f36436
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
1 change: 0 additions & 1 deletion package.json
Expand Up @@ -28,7 +28,6 @@
"inherits": "2.0.3",
"is-arguments": "^1.0.4",
"is-generator-function": "^1.0.7",
"is-promise": "^2.1.0",
"object.entries": "^1.1.0",
"safe-buffer": "^5.1.2"
},
Expand Down
17 changes: 16 additions & 1 deletion support/types.js
Expand Up @@ -7,7 +7,6 @@ var isBuffer = require('./isBuffer');

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

function uncurryThis(f) {
return f.call.bind(f);
Expand Down Expand Up @@ -59,6 +58,22 @@ exports.isArgumentsObject = isArgumentsObject;

exports.isGeneratorFunction = isGeneratorFunction;

// Taken from here and modified for better browser support
// https://github.com/sindresorhus/p-is-promise/blob/cda35a513bda03f977ad5cde3a079d237e82d7ef/index.js
function isPromise(input) {
return (
(
typeof Promise !== 'undefined' &&
input instanceof Promise
) ||
(
input !== null &&
typeof input === 'object' &&
typeof input.then === 'function' &&
typeof input.catch === 'function'
)
);
}
exports.isPromise = isPromise;

function isArrayBufferView(value) {
Expand Down

0 comments on commit 3f36436

Please sign in to comment.