See [[B.csv]]

Hierarchy

  • CSV

Constructors

Methods

  • A single character that represents the escape character for this parser

    Parameters

    • escapeChar: string

    Returns CSV

  • A single character that represents a field delimeter for this parser

    Parameters

    • fieldDelimiterCharacter: string

    Returns CSV

  • Provides each row for processing. This is the preferred way of processing a whole file. This is equivelent to:

        while(csv.next) {
    callback(csv.row);
    }

    Parameters

    • rowConsumer: ((row, index?, csv?) => void)
        • (row, index?, csv?): void
        • Parameters

          • row: EList<string>
          • Optional index: number
          • Optional csv: CSV

          Returns void

    Returns void

  • Returns true if there are more rows. Prepares [[row]] to contain data for the next row.

    Returns boolean

  • Returns the row in the file as an array of strings. Used in a while loop with [[next]]

    Returns EList<string>

    Example


    while(csv.next) {
    csv.row.forEach(function (col) {
    //process the column.
    });
    };
  • A single character that represents a text delimeter for this parser

    Parameters

    • textDelimeterCharacter: string

    Returns CSV

  • Copy the input to a two dimensional array

    Returns EList<EList<string>>

    Example


    csv.toList().forEach(function (row) {
    row.forEach(function (col) {
    //process the column.
    });
    });
  • Copy the input to an array of objects where the keys of the object come from the first row.

    Returns EList<{
        [key: string]: string;
    }>

    Example


    csv.toListOfObjects().forEach(function (row) {
    let firstName = row.First;
    let lastName = row.Last;
    let birthday = row.Birthday;
    });

Generated using TypeDoc