Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Parses comma seperated text
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
.gitignore
.travis.yml
README.md
example.js
index.js
package.json
test.csv
test.js

README.md

Columnist

Build Status

A node module for parsing out csv documents to an array of object literals as well as attempts to parse data into the numbers when possible

Example

test.csv

"brandon", "farmer", 30, 3.5
john, smith, 45, 4.0
tom, jones, 65, 2.5

JS file

var Columnist = require('columnist');
var data = require('fs').readFileSync('./test.csv', 'utf8');

var columnist = new Columnist(['first', 'last', 'age', 'gpa'], { /* options */ });

console.log(columnist.parse(data));

This example will result in the following array.

[ { first: 'brandon', last: 'farmer', age: 30, gpa: 3.5 },
  { first: 'john', last: 'smith', age: 45, gpa: 4 },
  { first: 'tom', last: 'jones', age: 65, gpa: 2.5 } ]

Options

  • ignore_first -- (default: false) will ignore the first line of the document
  • ignore_last -- (default: false) will ignore the last line of the document
  • remove_quotes -- (default: true) remove quotes from document
Something went wrong with that request. Please try again.