Skip to content

Commit

Permalink
Support cloning Symbols in cloneDeep
Browse files Browse the repository at this point in the history
  • Loading branch information
MrDoomBringer committed Oct 20, 2022
1 parent b23234e commit 2d5f4b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utilities/common/cloneDeep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ function cloneDeepHelper<T>(val: T, seen?: Map<any, any>): T {
// possible in all JS environments, so we will assume they exist/work.
const copy = Object.create(Object.getPrototypeOf(val));
seen.set(val, copy);
Object.keys(val).forEach(key => {
Object.keys(val).concat(Object.getOwnPropertySymbols(val) as any).forEach(key => {
copy[key] = cloneDeepHelper((val as any)[key], seen);
});
return copy;
}

default:
return val;
}
Expand Down

0 comments on commit 2d5f4b1

Please sign in to comment.