Function: formatToCsv()
formatToCsv<
T
>(array
,schema
):string
Format an array to CSV string
Type Parameters
Type Parameter |
---|
T extends TCsvSchema |
Parameters
Parameter | Type | Description |
---|---|---|
array | StaticDecode <T >[] | An array of data |
schema | T | Output schema mapping of each row |
Returns
string
A CSV string
Throws
If fail to format the array
Example
ts
const output = formatAsCsv([{ id: 1, name: 'a' }], schema);