The options for a parser.

interface IOptions {
    columnOffsets: boolean;
    data: string;
    delimiter?: string;
    maxRows?: number;
    ncols?: number;
    quote?: string;
    rowDelimiter?: string;
    startIndex?: number;
}

Properties

columnOffsets: boolean

Whether to return column offsets in the offsets array.

Notes

If false, the returned offsets array contains just the row offsets. If true, the returned offsets array contains all column offsets for each column in the rows (i.e., it has nrows*ncols entries). Individual rows will have empty columns added or extra columns merged into the last column if they do not have exactly ncols columns.

data: string

The data to parse.

delimiter?: string

The delimiter to use. Defaults to ','.

maxRows?: number

Maximum number of rows to parse.

If this is not given, parsing proceeds to the end of the data.

ncols?: number

Number of columns in each row to parse.

Notes

If this is not given, the ncols defaults to the number of columns in the first row.

quote?: string

The quote character for quoting fields. Defaults to the double quote (").

Notes

As specified in RFC 4180, quotes are escaped in a quoted field by doubling them (for example, "a""b" is the field a"b).

rowDelimiter?: string

The row delimiter to use. Defaults to '\r\n'.

startIndex?: number

The starting index in the string for processing. Defaults to 0. This index should be the first character of a new row. This must be less than data.length.