File tree Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Expand file tree Collapse file tree 1 file changed +9
-12
lines changed Original file line number Diff line number Diff line change @@ -130,9 +130,15 @@ function patchInstanceOf(
130
130
// @ts -ignore
131
131
ctx [ Symbol . for ( `node:${ item } ` ) ] = eval ( item )
132
132
133
- const shouldPatchPrototype = patchedPrototypes . has ( item )
133
+ const patchPrototype = ! patchedPrototypes . has ( item )
134
+ ? ''
135
+ : `Object.assign(globalThis.${ item } .prototype, {
136
+ get constructor() {
137
+ return proxy;
138
+ }
139
+ })`
134
140
135
- return runInContext (
141
+ runInContext (
136
142
`
137
143
(() => {
138
144
const proxy = new Proxy(${ item } , {
@@ -163,16 +169,7 @@ function patchInstanceOf(
163
169
})
164
170
165
171
globalThis.${ item } = proxy;
166
-
167
- ${
168
- ! shouldPatchPrototype
169
- ? ''
170
- : `Object.assign(globalThis.${ item } .prototype, {
171
- get constructor() {
172
- return proxy;
173
- }
174
- })`
175
- }
172
+ ${ patchPrototype }
176
173
})()
177
174
` ,
178
175
ctx ,
You can’t perform that action at this time.
0 commit comments