(value: unknown)
| 13 | export type SdkFormData = WebFormData | LegacyNodeFormData; |
| 14 | |
| 15 | export const isFormData = (value: unknown): value is SdkFormData => { |
| 16 | if (!value || typeof value !== "object") { |
| 17 | return false; |
| 18 | } |
| 19 | if (typeof FormData !== "undefined" && value instanceof FormData) { |
| 20 | return true; |
| 21 | } |
| 22 | const candidate = value as Partial<LegacyNodeFormData>; |
| 23 | if (typeof candidate.append !== "function") { |
| 24 | return false; |
| 25 | } |
| 26 | if (typeof candidate.getHeaders === "function") { |
| 27 | return true; |
| 28 | } |
| 29 | return candidate.constructor?.name === "FormData"; |
| 30 | }; |
| 31 | |
| 32 | export const getFormDataHeaders = (form: SdkFormData): Headers => { |
| 33 | if ("getHeaders" in form && typeof form.getHeaders === "function") { |
no outgoing calls
no test coverage detected