npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

csv-spectrum

v2.0.0

Published

csv test data for writing robust csv parsers

Downloads

31,981

Readme

csv-spectrum

NPM

A bunch of different CSV files to serve as an acid test for CSV parsing libraries. There are also JSON versions of the CSVs for verification purposes.

The goal of this repository is to capture test cases to represent the entire CSV spectrum.

Please use these in your test suites and send contributions in the form of more/improved test cases.

It is also a node module that you can require() in your tests

Some CSVs here were included from csvkit

https://github.com/maxogden/binary-csv uses csv-spectrum and passes all tests

programmatic usage

vsr spectrum = require('csv-spectrum')
spectrum(function(err, data) {
  // data is an array of objects has all the csv and json versions of the tests
})

data looks like this:

[ { csv: <Buffer 66 69 72 73 74 2c 6c 61 73 74 2c 61 64 64 72 65 73 73 2c 63 69 74 79 2c 7a 69 70 0a 4a 6f 68 6e 2c 44 6f 65 2c 31 32 30 20 61 6e 79 20 73 74 2e 2c 22 41 ...>,
    json: <Buffer 5b 0a 20 20 7b 0a 20 20 20 20 22 66 69 72 73 74 22 3a 20 22 4a 6f 68 6e 22 2c 0a 20 20 20 20 22 6c 61 73 74 22 3a 20 22 44 6f 65 22 2c 0a 20 20 20 20 22 ...>,
    name: 'comma_in_quotes' },
  { csv: <Buffer 61 2c 62 0a 31 2c 22 68 61 20 22 22 68 61 22 22 20 68 61 22 0a 33 2c 34 0a>,
    json: <Buffer 5b 0a 20 20 7b 0a 20 20 20 20 22 61 22 3a 20 22 31 22 2c 0a 20 20 20 20 22 62 22 3a 20 22 68 61 20 5c 22 68 61 5c 22 20 68 61 22 0a 20 20 7d 2c 0a 20 20 ...>,
    name: 'escaped_quotes' }
  // etc
]

example usage in a test might be:

vsr spectrum = require('csv-spectrum')
spectrum(function(err, data) {
  console.log('testing ' + data[0].name)
  t.equal(csv2json(data[0].csv), JSON.parse(data[0].json))
})