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 🙏

© 2025 – Pkg Stats / Ryan Hefner

lotivis-csv

v1.0.2

Published

GeoJson for lotivis.js

Readme

lotivis-csv Node.js CI

This module provides functions for reading and writing CSV files with lotivis using d3-dsv.

var text = `
label,location,date,value,group
label-1,paris,1999-01-01,1,group-1
label-1,berlin,1999-01-02,2,group-1
`;

var data = lotivis.csvParse(text);

Installing

If you use npm, npm install lotivis-csv. You can also download the latest realease on GitHub. For using in browsers, you can load the UMD bundle from an npm-based CDN such as jsDelivr.

<script src="https://cdn.jsdelivr.net/..."></script>
<script>

// ...

</script>

API Reference

lotivis.csvParse(string)

To read csv data use the csvParse function.

var text = `
label,location,date,value,group
label-1,paris,1999-01-01,1,group-1
label-1,berlin,1999-01-02,2,group-1
`;

var data = lotivis.csvParse(text);

Using the correct names the order of the headlines is variable.

var text = `
value,label,location,group,date
1,label-1,paris,group-1,1999-01-01
2,label-1,berlin,group-1,1999-01-02
`;

var data = lotivis.csvParse(text);

lotivis.csvParseRow(string [, row])

To read csv data without headlines use the csvParseRows function. If the csv data is in the default order (label,location,data,value[,group]).

var text = `
label-1,paris,1999-01-01,1,group-1
label-1,berlin,1999-01-02,2,group-1
`;

var data = lotivis.csvParseRows(text);

When reading csv data in custom order without headlines specify a parse function as second parameter which handles each row.

var text = `
1,label-1,paris,group-1,1999-01-01
2,label-1,berlin,group-1,1999-01-02
`;

let data = csvParseRows(text, (row, index) => {
    return {
        value: row[0],
        label: row[1],
        location: row[2],
        group: row[3],
        date: row[4],
    };
});

lotivis.csvRender(data [, columns])

Creates a csv string from the specified data. Optionally specifiy the order of the columns with columns. The default order is ["label", "location", "date", "value", "group"].

lotivis.csvRenderRows(data [, columns])

Creates a csv string without headlines from the specified data. Optionally specifiy the order of the columns with columns.

lotivis.fetchCSV(path)

Fetches and parses the data from the csv files specified through the given path.

lotivis.fetchCSV("path/to/data.csv")
    .then((data) => {
        // do something with data ...
    })
    .catch((error) => { /* */});

lotivis.fetchCSVRows(path [, row])

Fetches and parses the data from the csv files specified through the given path. The row argument works in a simular manner as in csvParseRow.

Development

# build module
yarn build

# develop module
yarn build:watch