We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 42d9928 commit 5170238Copy full SHA for 5170238
src/vs/base/common/objects.ts
@@ -10,16 +10,11 @@ export function deepClone<T>(obj: T): T {
10
return obj;
11
}
12
if (obj instanceof RegExp) {
13
- // See https://github.com/microsoft/TypeScript/issues/10990
14
- return obj as any;
+ return obj;
15
16
const result: any = Array.isArray(obj) ? [] : {};
17
- Object.keys(<any>obj).forEach((key: string) => {
18
- if ((<any>obj)[key] && typeof (<any>obj)[key] === 'object') {
19
- result[key] = deepClone((<any>obj)[key]);
20
- } else {
21
- result[key] = (<any>obj)[key];
22
- }
+ Object.entries(obj).forEach(([key, value]) => {
+ result[key] = value && typeof value === 'object' ? deepClone(value) : value;
23
});
24
return result;
25
0 commit comments