From 866fa7ab77c023edd17aa2cbb97e8dd67ab1df61 Mon Sep 17 00:00:00 2001 From: Jeongho Nam Date: Wed, 17 Jul 2024 10:54:52 +0900 Subject: [PATCH] Fix `$clone()` function for `File` class case. 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. --- src/functional/$clone.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/functional/$clone.ts b/src/functional/$clone.ts index 3c8812d1ba..e576ac2652 100644 --- a/src/functional/$clone.ts +++ b/src/functional/$clone.ts @@ -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(