# new Configurable(initialConfigopt)
Initialize a configurable parser instance.
Parameters:
| Name | Type | Attributes | Description |
|---|---|---|---|
initialConfig |
object
|
<optional> |
Initial parser configuration values |
Methods
# encoding(encoding) → {this}
Set the file encoding for reading CSV files.
Parameters:
| Name | Type | Description |
|---|---|---|
encoding |
string
|
Node.js supported encoding |
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 |
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 |
For method chaining
this
# getParserConfig() → {ParserConfig}
Create an immutable parser configuration snapshot.
Frozen parser configuration
# ignoreColumnIndexes(indexes) → {this}
Configure column indexes to exclude from output.
Parameters:
| Name | Type | Description |
|---|---|---|
indexes |
Array.<number>
|
Column indexes to ignore |
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 |
For method chaining
this
# mapRows(mapperFn) → {this}
Set a mapper function for row transformation.
Parameters:
| Name | Type | Description |
|---|---|---|
mapperFn |
function
|
Function receiving (row, index) |
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 |
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 |
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 |
For method chaining
this