An options object for initializing a delimiter-separated data model.

interface IOptions {
    data: string;
    delimiter: string;
    header?: boolean;
    initialRows?: number;
    quote?: string;
    quoteParser?: boolean;
    rowDelimiter?: "\r\n" | "\r" | "\n";
}

Properties

data: string

The data source for the data model.

delimiter: string

The field delimiter, such as ',' or '\t'.

Notes

The field delimiter must be a single character.

header?: boolean

Whether the data has a one-row header.

initialRows?: number

The maximum number of initial rows to parse before doing a asynchronous full parse of the data. This should be greater than 0.

quote?: string

Quote character.

Notes

Quotes are escaped by repeating them, as in RFC 4180. The quote must be a single character.

quoteParser?: boolean

Whether to use the parser that can handle quoted delimiters.

Notes

Setting this to false uses a much faster parser, but assumes there are not any field or row delimiters that are quoted in fields. If this is not set, it defaults to true if any quotes are found in the data, and false otherwise.

rowDelimiter?: "\r\n" | "\r" | "\n"

Row delimiter.

Notes

Any carriage return or newline character that is not a delimiter should be in a quoted field, regardless of the row delimiter setting.