Skip to content

Function: parseCSVRecords() ​

ts
function parseCSVRecords(text, delimiter?): string[][];

Split RFC 4180 text into records of fields: fields are separated by the delimiter and records by CRLF, LF or CR; a field in double quotes may contain delimiters, line breaks and "" (one quote). A final line break does not start another record. A byte-order mark is dropped.

Parameters ​

ParameterTypeDefault value
textstringundefined
delimiterstring','

Returns ​

string[][]

Throws ​

For a quote inside an unquoted field, text after a closing quote, or a quoted field that never closes (with the line number).

Released under the MIT License.