Class

Configurable

Configurable(initialConfigopt)

Shared configuration builder for CSV parser clients. Provides chainable methods for parser options and snapshots.

Constructor

# new Configurable(initialConfigopt)

Initialize a configurable parser instance.

Parameters:
Name Type Attributes Description
initialConfig object <optional>

Initial parser configuration values

View Source src/core/configurable.js, line 10

Methods

# encoding(encoding) → {this}

Set the file encoding for reading CSV files.

Parameters:
Name Type Description
encoding string

Node.js supported encoding

View Source src/core/configurable.js, line 112

For method chaining

this

# fieldDelimiter(delimiter) → {this}

Set the field delimiter character.

Parameters:
Name Type Description
delimiter string

Character(s) to use as field separator

View Source src/core/configurable.js, line 44

For method chaining

this

# formatValueByType(active) → {this}

Enable or disable automatic type formatting for values.

Parameters:
Name Type Default Description
active boolean true

Whether to format values by type

View Source src/core/configurable.js, line 24

For method chaining

this

# getParserConfig() → {ParserConfig}

Create an immutable parser configuration snapshot.

View Source src/core/configurable.js, line 121

Frozen parser configuration

ParserConfig

# ignoreColumnIndexes(indexes) → {this}

Configure column indexes to exclude from output.

Parameters:
Name Type Description
indexes Array.<number>

Column indexes to ignore

View Source src/core/configurable.js, line 102

For method chaining

this

# indexHeader(indexHeaderValue) → {this}

Set the row index where CSV headers are located.

Parameters:
Name Type Description
indexHeaderValue number

Zero-based row index containing headers

View Source src/core/configurable.js, line 64

For method chaining

this

# mapRows(mapperFn) → {this}

Set a mapper function for row transformation.

Parameters:
Name Type Description
mapperFn function

Function receiving (row, index)

View Source src/core/configurable.js, line 89

For method chaining

this

# parseSubArray(delimiter, separator) → {this}

Configure sub-array parsing for special field values.

Parameters:
Name Type Default Description
delimiter string *

Bracket character

separator string ,

Item separator within brackets

View Source src/core/configurable.js, line 78

For method chaining

this

# supportQuotedField(active) → {this}

Enable or disable support for RFC 4180 quoted fields.

Parameters:
Name Type Default Description
active boolean false

Whether to support quoted fields

View Source src/core/configurable.js, line 34

For method chaining

this

# trimHeaderFieldWhiteSpace(active) → {this}

Configure whitespace handling in header field names.

Parameters:
Name Type Default Description
active boolean false

Whether to trim whitespace in header names

View Source src/core/configurable.js, line 54

For method chaining

this