JSPM

  • Created
  • Published
  • Downloads 4047605
  • Score
    100M100P100Q222033F
  • License BSD-3-Clause

A parser and formatter for DSV (CSV and TSV) files.

Package Exports

  • d3-dsv

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (d3-dsv) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

d3-dsv

A parser and formatter for delimiter-separated values, most commonly comma-separated values (CSV) or tab-separated values (TSV).

To parse CSV in the browser:

<script src="dsv.js"></script>
<script>

console.log(dsv.csv.parse("foo,bar\n1,2")); // [{foo: "1", bar: "2"}]

</script>

To parse CSV in Node.js, npm install d3-dsv, and then:

var dsv = require("d3-dsv");

console.log(dsv.csv.parse("foo,bar\n1,2")); // [{foo: "1", bar: "2"}]

To define a new delimiter, use the dsv constructor:

var psv = dsv.dsv("|");

console.log(psv.parse("foo|bar\n1|2")); // [{foo: "1", bar: "2"}]

For more usage, see D3’s wiki page.