(value: unknown)
| 59 | } |
| 60 | } |
| 61 | function extractFilesFromValue(value: unknown): File[] { |
| 62 | if (value instanceof File) return [value]; |
| 63 | |
| 64 | if (!Array.isArray(value)) return []; |
| 65 | |
| 66 | return value.flatMap(entry => { |
| 67 | if (entry instanceof File) return [entry]; |
| 68 | |
| 69 | if (!entry || typeof entry !== "object") return []; |
| 70 | |
| 71 | const uploadFile = "file" in entry ? entry.file : null; |
| 72 | if (uploadFile instanceof File) return [uploadFile]; |
| 73 | |
| 74 | const item = "item" in entry && entry.item && typeof entry.item === "object" ? entry.item : null; |
| 75 | if (!item || !("file" in item)) return []; |
| 76 | |
| 77 | return item.file instanceof File ? [item.file] : []; |
| 78 | }); |
| 79 | } |
| 80 | |
| 81 | function interceptUploadAddFiles(event: unknown): void { |
| 82 | if (!event || typeof event !== "object" || !("type" in event)) return; |
no outgoing calls
no test coverage detected