Socket
Book a DemoInstallSign in
Socket

csv-to-collection

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

csv-to-collection

reads a csv file and returns a collection of objects, using the first record's values as labels

0.0.1
latest
npmnpm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

csv-to-collection

A Node.js package that reads a csv file and returns a collection of objects, using the first record's values as field labels.

For example:

// this csv:
//
// name,age
// sally,5
// billy,10

// becomes...
[
	{name: "sally", age: "5"},
	{name: "billy", age: "10"}
]

Usage

var csv = require('csv-to-collection');

csv.readCsv(__dirname + "/test.csv", function (err, data) {
	if (err) throw err;
	console.log(data);
});

Special Notes

Some of the header row values are altered and cleaned up before they are used as labels:

  • new line characters are removed
  • multiple spaces are replaced with 1 space
  • all characters are converted to lower case

There are currently no options for this module. I'll add them when I need them, or as requested. Right now the module assumes UTF8 encoded, comma delimited, quote escaped csv files.

Installation

npm install csv-to-collection

License

MIT

Keywords

csv

FAQs

Package last updated on 10 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.