tonightpass 0.0.98 → 0.0.100

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1,21 @@
1
1
  export const isBrowser = typeof window !== "undefined";
2
+
3
+ export function buildFileFormData(
4
+ key: string,
5
+ files: File | File[] | FileList,
6
+ ): FormData {
7
+ const formData = new FormData();
8
+
9
+ if (files instanceof File) {
10
+ // Single file case
11
+ formData.append(key, files);
12
+ } else if (files instanceof FileList) {
13
+ // FileList case
14
+ Array.from(files).forEach((file) => formData.append(key, file));
15
+ } else {
16
+ // Array of files case
17
+ files.forEach((file) => formData.append(key, file));
18
+ }
19
+
20
+ return formData;
21
+ }