Commit 3de2ea5 1 parent 89ef9af commit 3de2ea5 Copy full SHA for 3de2ea5
File tree 1 file changed +2
-2
lines changed
packages/SwingSet/src/kernel/vat-loader
1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 19
19
* @returns {T extends PromiseLike<any> ? Promise<Awaited<R>> : R }
20
20
*/
21
21
export function maybeAsync ( v , handle ) {
22
- if ( typeof v === 'object' && v !== null && 'then' in v ) {
22
+ if ( Object ( v ) === v && typeof v . then === 'function' ) {
23
23
return Promise . resolve ( v ) . then ( handle ) ;
24
24
} else {
25
25
return handle ( v ) ;
@@ -37,7 +37,7 @@ export function ensureSync(fn) {
37
37
// eslint-disable-next-line func-names
38
38
return function ( ...args ) {
39
39
const result = Reflect . apply ( fn , this , args ) ;
40
- if ( typeof result === 'object' && result !== null && 'then' in result ) {
40
+ if ( Object ( result ) === result && typeof result . then === 'function' ) {
41
41
throw new Error ( 'Unexpected async result' ) ;
42
42
} else {
43
43
return result ;
You can’t perform that action at this time.
0 commit comments