Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

comma-separated

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

comma-separated

Simple CSV serialization mirroring JSON.parse and stringify.

  • 2.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Comma Separated

Simple CSV serialization

npm Version Build Status Greenkeeper badge JS Standard Style MIT License

Simple CSV serialization mirroring JSON.parse and stringify. This follows RFC 4180 rules, and only handles commas as delimiters. This is not a general parser for any character-delimited format.

The api is very similar to the native JSON object in JavaScript.

CSV.parse(csvString [, reviver ])

csvString is a well-formated string of csv data. reviver is an optional function that takes the row index, column index, and cell string value. The function should return the desired value for that cell.

The reviver is an opportunity to to do extra parsing from a cell's string format. For example if the string matches an iso date format, you may want to have a Date object instead of the raw string in the final array.

The default reviver simply returns the field's string value.

CSV.stringify(tableArray [, replacer])

tableArray is a 2 dimensional array of values to stringify. replacer is an optional function that takes the row index, column index, and cell string value. The function should return a string value for that cell.

The replacer is an opportunity to do a custom string format for particular cells. This is useful if you have objects for cell values that do not have a desirable toString function.

The default replacer simply converts to a string. (ie: '' + value)

Keywords

FAQs

Package last updated on 21 Feb 2019

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc