Skip to content

Commit

Permalink
Fix $clone() function for File class case.
Browse files Browse the repository at this point in the history
Previous `$clone()` function could not actually clone the `File` class typed instance because the `Blob` class typed if condition statement will block the `File` class typed case.

This PR fixes the bug.
  • Loading branch information
samchon committed Jul 17, 2024
1 parent 577ab21 commit 866fa7a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/functional/$clone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ const $cloneMain = (value: any): any => {
else if (value instanceof SharedArrayBuffer) return value.slice(0);
else if (value instanceof DataView)
return new DataView(value.buffer.slice(0));
else if (value instanceof Blob)
return new Blob([value], { type: value.type });
else if (value instanceof File)
return new File([value], value.name, { type: value.type });
else if (value instanceof Blob)
return new Blob([value], { type: value.type });
else if (value instanceof Set) return new Set([...value].map($cloneMain));
else if (value instanceof Map)
return new Map(
Expand Down

0 comments on commit 866fa7a

Please sign in to comment.