columnist

0.0.3 • Public • Published

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

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 0.0.3
    2
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 0.0.3
    2
  • 0.0.2
    1
  • 0.0.1
    0

Package Sidebar

Install

npm i columnist

Weekly Downloads

3

Version

0.0.3

License

BSD

Last publish

Collaborators

  • bthesorceror