File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,6 @@ describe('Types > isObj', () => {
37
37
this . name = name ;
38
38
}
39
39
}
40
-
41
40
expect ( isObj ( new Person ( 'x' ) ) ) . toBe ( false ) ;
42
41
expect ( isObj ( new ( fun as any ) ( 1 ) ) ) . toBe ( false ) ;
43
42
} ) ;
@@ -47,5 +46,14 @@ describe('Types > isObj', () => {
47
46
expect ( isObj ( { a : 1 } ) ) . toBe ( true ) ;
48
47
expect ( isObj ( new Object ( ) ) ) . toBe ( true ) ;
49
48
expect ( isObj ( Object . create ( null ) ) ) . toBe ( true ) ;
49
+
50
+ if ( globalThis . structuredClone ) {
51
+ const obj = {
52
+ a : 1 ,
53
+ b : 'Hello world' ,
54
+ } ;
55
+ const clone = structuredClone ( obj ) ;
56
+ expect ( isObj ( structuredClone ( obj ) ) ) . toBe ( true ) ;
57
+ }
50
58
} ) ;
51
59
} ) ;
Original file line number Diff line number Diff line change @@ -18,5 +18,5 @@ export default function isObj(val: unknown): val is object {
18
18
19
19
const p = Object . getPrototypeOf ( val ) ;
20
20
21
- return p === null || p === Object . prototype ;
21
+ return p === null || Object . getPrototypeOf ( p ) === null ;
22
22
}
You can’t perform that action at this time.
0 commit comments