Skip to content

Commit 5c9860c

Browse files
authored
simplify code for demo (microsoft#180932)
1 parent 7d76d94 commit 5c9860c

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/vs/workbench/api/common/extHostConfiguration.ts

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,13 @@ export class ExtHostConfigProvider {
191191
} else {
192192
let clonedConfig: any | undefined = undefined;
193193
const cloneOnWriteProxy = (target: any, accessor: string): any => {
194-
let clonedTarget: any | undefined = undefined;
195-
const cloneTarget = () => {
196-
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
197-
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
198-
};
199-
return isObject(target) ?
200-
new Proxy(target, {
194+
if (isObject(target)) {
195+
let clonedTarget: any | undefined = undefined;
196+
const cloneTarget = () => {
197+
clonedConfig = clonedConfig ? clonedConfig : deepClone(config);
198+
clonedTarget = clonedTarget ? clonedTarget : lookUp(clonedConfig, accessor);
199+
};
200+
return new Proxy(target, {
201201
get: (target: any, property: PropertyKey) => {
202202
if (typeof property === 'string' && property.toLowerCase() === 'tojson') {
203203
cloneTarget();
@@ -234,7 +234,9 @@ export class ExtHostConfigProvider {
234234
}
235235
return true;
236236
}
237-
}) : target;
237+
});
238+
}
239+
return target;
238240
};
239241
result = cloneOnWriteProxy(result, key);
240242
}

0 commit comments

Comments
 (0)