1.1.1 • Published 4 years ago

csvr v1.1.1

Weekly downloads
1
License
MIT
Repository
-
Last release
4 years ago

csvr

Small JavaScript utility for parsing the rows of a CSV file

Set up

Install using npm or script tag

npm install csvr
<script src="path/to/csvr.js"></script>

Usage

Use the parseRow function to turn a CSV row into an array of values. Use the unparseRow function to turn an array into a CSV row.

var row = '"dogs","cats","birds"'
var vals = csvr.parseRow(row)
console.log(vals); // ["dogs", "cats", "birds"]

var rowAgain = csvr.unparseRow(vals)
console.log(rowAgain); // "dogs","cats","birds"

Both functions have an optional second parameter which is an options object. This allows you to set the delimiter and quote character.

var row = '-dogs-|-cats-|-birds-'
var options = {
  delimiter: '|',
  quoteChar: '-'
}
csvr.parseRow(row, options) // ["dogs", "cats", "birds"]
1.1.1

4 years ago

1.1.0

5 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago