Options
All
  • Public
  • Public/Protected
  • All
Menu

A Parser instance is used to parse CSV data according to a given configuration.

Hierarchy

Index

Constructors

constructor

  • Construct a new Parser instance using the given configuration and serialized CSV data input.

    Note that a call to the Parser.parse method will be required to assign a data source to the Parser instance before it can provide useful parsing behavior.

    Parameters

    • Optional options: Options

      Optional Options object to determine parsing behavior for this Parser instance.

    Returns Parser

Properties

newline

newline: string

Row separator string.

quote

quote: string

Quote/escape character.

quoteAll

quoteAll: boolean

Whether to quote/escape all columns when serializing.

separator

separator: string

Column separator character.

Optional source

source: ParserSource

Methods

__@iterator

  • __@iterator(): this
  • Implement ES6 iterable interface.

    Returns this

    This instance, which is both an iterable and an iterator.

configure

  • configure(options?: Options): this
  • Apply the given options to this Configurable object.

    Parameters

    • Optional options: Options

      Optional Options object to determine parsing or serialization behavior.

    Returns this

    This instance, for easy chaining.

next

  • next(): IteratorResult<string[]>
  • Implement ES6 iterator interface.

    Returns IteratorResult<string[]>

    An ES6 iterator result object having "done" and "value" properties.

nextRow

  • nextRow(): string[] | undefined
  • Parse one row from the data source and advance to the next row.

    Returns string[] | undefined

    An array of column strings, or undefined if there were no rows left to parse.

parse

  • Assign an input serialized CSV data source to this Parser.

    Parameters

    • source: ParserSourceParameter

      The CSV data input. This can be a string, a NodeJS readable stream, or any iterable or iterator which enumerates serialized CSV data one character at a time.

    Returns this

    This instance, for easy chaining.

rows

  • rows(): string[][]
  • Eagerly consume the entire source data in order to produce an array of all the rows represented within the serialized CSV data. Note that this myParser.rows() is behaviorally identical to Array.from(myParser) and is provided for the sake of convenience.

    Returns string[][]

    An array of rows, where each row is an array of columns, and each column is simply represented by a string value.

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc