Skip to content

Commit

Permalink
fix: update
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib committed Nov 22, 2024
1 parent 07d6907 commit 37e470b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/utils/copy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,12 @@ function deepClone(target: any) {
return new Map(iterable);
}
if (target instanceof Set) {
const iterable = Array.from(target).map(deepClone);
if (!isBaseSetInstance(target)) {
const SubClass = Object.getPrototypeOf(target).constructor;
return new SubClass(Array.from(target).map(deepClone));
return new SubClass(iterable);
}
return new Set(Array.from(target).map(deepClone));
return new Set(iterable);
}
const copy = Object.create(Object.getPrototypeOf(target));
for (const key in target) copy[key] = deepClone(target[key]);
Expand Down

0 comments on commit 37e470b

Please sign in to comment.