parcel-transformer-papaparse
v0.1.0
Published
Parcel transformer to enable CSV and TSV import
Downloads
2
Maintainers
Readme
parcel-transformer-papaparse
This transformer enables CSV and TSV import in Parcel.
With the default Parcel configuration, Parcel does not include any transformers for CSV files.
Thus, this is the dedicated plugin whenever you need to import some CSV data.
Installation
npm i -D parcel-transformer-papaparse
Configuration
Add the plugin to your .parcelrc
:
{
"extends": "@parcel/config-default",
"transformers": {
"*.{csv,tsv}": ["parcel-transformer-papaparse"]
}
}
To customize the parsing behavior, specify any options listed in the Papa Parse documentation with a papaparse
property in package.json
or in a .papaparserc
file to override the default config listed below:
{
"dynamicTyping": true,
"header": true,
"skipEmptyLines": true
}
The config object is then passed directly to the Papa.parse
function.
For example, to support comments:
{
"comments": "#" // or "//" or whatever you like
}
The following alternative config filenames are also available, and are searched in order (it works similar to Cosmiconfig, but with toml
instead of yaml
support due to Parcel’s limitation):
.papaparserc.json
.papaparserc.toml
.papaparserc.js
.papaparserc.cjs
.config/papaparserc
.config/papaparserc.json
.config/papaparserc.toml
.config/papaparserc.js
.config/papaparserc.cjs
papaparse.config.js
papaparse.config.cjs