Function: parseCsv()
parseCsv<
T
>(content
,schema
):StaticDecode
<T
>[]
Parse the CSV string according to the given schema
Type Parameters
Type Parameter |
---|
T extends TCsvSchema |
Parameters
Parameter | Type | Description |
---|---|---|
content | string | A string of CSV file content |
schema | T | Output schema mapping of each row |
Returns
StaticDecode
<T
>[]
An array of given schema
Throws
If fail to parse the schema
Example
ts
const output = parseCsv('ID,Name\n1,A\n2,B\n', schema);