(value: any)
| 34 | } |
| 35 | |
| 36 | export async function stringifyIO(value: any): Promise<IOPacket> { |
| 37 | if (value === undefined) { |
| 38 | return { dataType: "application/json" }; |
| 39 | } |
| 40 | |
| 41 | if (typeof value === "string") { |
| 42 | return { data: value, dataType: "text/plain" }; |
| 43 | } |
| 44 | |
| 45 | try { |
| 46 | const { stringify } = await loadSuperJSON(); |
| 47 | const data = stringify(value); |
| 48 | |
| 49 | return { data, dataType: "application/super+json" }; |
| 50 | } catch { |
| 51 | return { data: value, dataType: "application/json" }; |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | export async function conditionallyExportPacket( |
| 56 | packet: IOPacket, |
no test coverage detected
searching dependent graphs…