jest-util
Advanced tools
Comparing version 29.0.3 to 29.1.0
@@ -84,5 +84,5 @@ /** | ||
export declare const isPromise: ( | ||
export declare function isPromise<T = unknown>( | ||
candidate: unknown, | ||
) => candidate is Promise<unknown>; | ||
): candidate is PromiseLike<T>; | ||
@@ -89,0 +89,0 @@ declare type Matcher = (str: string) => boolean; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
}); | ||
exports.default = void 0; | ||
exports.default = isPromise; | ||
@@ -15,8 +15,8 @@ /** | ||
*/ | ||
// capture globalThis.Promise before it may potentially be overwritten | ||
const Promise = globalThis.Promise; // see ES2015 spec 25.4.4.5, https://stackoverflow.com/a/38339199 | ||
const isPromise = candidate => Promise.resolve(candidate) === candidate; | ||
var _default = isPromise; | ||
exports.default = _default; | ||
function isPromise(candidate) { | ||
return ( | ||
candidate != null && | ||
(typeof candidate === 'object' || typeof candidate === 'function') && | ||
typeof candidate.then === 'function' | ||
); | ||
} |
{ | ||
"name": "jest-util", | ||
"version": "29.0.3", | ||
"version": "29.1.0", | ||
"repository": { | ||
@@ -20,3 +20,3 @@ "type": "git", | ||
"dependencies": { | ||
"@jest/types": "^29.0.3", | ||
"@jest/types": "^29.1.0", | ||
"@types/node": "*", | ||
@@ -38,3 +38,3 @@ "chalk": "^4.0.0", | ||
}, | ||
"gitHead": "77f865da39af5b3e1c114dc347e49257eb3dcfd1" | ||
"gitHead": "51f10300daf90db003a1749ceaed1084c4f74811" | ||
} |
1100
35724
Updated@jest/types@^29.1.0