https://github.com/breuleux/quaint-csv
Read/format CSV data in Quaint
https://github.com/breuleux/quaint-csv
csv quaint
Last synced: 12 months ago
JSON representation
Read/format CSV data in Quaint
- Host: GitHub
- URL: https://github.com/breuleux/quaint-csv
- Owner: breuleux
- Created: 2015-12-10T16:08:11.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2017-02-02T05:33:45.000Z (about 9 years ago)
- Last Synced: 2025-04-14T20:10:04.551Z (12 months ago)
- Topics: csv, quaint
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
quaint-csv
==========
CSV support for the `data` macro in
[Quaint](http://breuleux.github.io/quaint).
## Install
quaint --setup csv
## Usage
```quaint
format table ::
data csv ::
Name,Job
Alice,accountant
Bob,baker
```
Importing from a file:
```quaint
rows => data :: jobs.csv
each {rows} row ::
* {row.Name}'s job is {row.Job}
;; output:
;; * Alice's job is accountant
;; * Bob's job is baker
```
## Sample configuration
This configuration entry must be added in the `plugins` section of
`quaint.json`:
```json
"csv": {
"recordSeparator": "\n",
"fieldSeparator": ",",
"quote": "\"",
"trim": false,
"useHeader": true
}
```
## Options
### extension
The file extension to use for the CSV files. (default: "csv")
### recordSeparator
The separator character for records (default: `\n`)
### fieldSeparator
The separator character for fields (default: `,`)
### quote
The character used for quoting (default: `"`)
### trim (boolean)
Whether to trim field values. (default: false)
### useHeader (boolean)
Whether to use the first line as field names or not. (default: true)
If this is true, then the result is an array of records with the names
taken from the first line of the file, otherwise it will be an array
of arrays.