parcel-transformer-papaparse
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

parcel-transformer-papaparse

npm types license

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

Package Sidebar

Install

npm i parcel-transformer-papaparse

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

6.46 kB

Total Files

7

Last publish

Collaborators

  • graphemecluster