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

data-spring

v0.1.11

Published

Data Spring generates fake datasets geared towards dashboards and data visualizations.

Downloads

7

Readme

Data Spring

:warning: Data Spring is still very much in an experimental and beta state. As a result, features and implementation likely will change.

Data Spring generates fake datasets geared towards dashboards and data visualizations. Sure a lot of libraries already exist for generating fake data, but I was not able to find a solution that was well tailored for these use cases. Data Spring is designed with the use case of generating datasets for prototyping data driven dashboards and data visualizations. As a result, it is fast and easy to create things like large time series datasets using Data Spring.

Data Spring is available both as a JavaScript library as well as a standalone CLI. Instructions for using both are included below

Getting Started

Install the package using yarn or npm.

# yarn
yarn add data-spring

#npm
npm install data-spring

After installing, add it to your project where you want to generate data. For instance, it can easily be plugged into an API endpoint or directly into a React component. The below snippet gives you the rough idea of usage.

The config argument is how you define the shape of your dataset (i.e. creating fields and possible values for them).

import { DataSpring } from 'data-spring';

// config object that is passed to data spring
// aka how you want your data to look
const config = [
  { id: 'rec_id', type: 'id' }, // auto generates a uuid
  {
    id: 'date',
    type: 'date',
    interval: {
      // i.e. 'hour' | 'day' | 'month' | 'year'
      type: 'month',
      // # of records to generate before stepping to next interval
      recordsPerInterval: 2,
    },
    min: '2020-01-01 00:00:00',
    max: '2020-12-01 00:00:00',
  },
  {
    id: 'department',
    type: 'string',
    values: ['Transportation', 'Environment', 'Health', 'Parks'],
  },
  {
    id: 'budget',
    type: 'number',
    min: 10000,
    max: 100000,
  },
];

const data = DataSpring(config);

The above example will generate something that looks roughly like...

[
  {
    id: '6b41a4ed-6319-4c23-83c7-32eb5a655e7f',
    date: '2020-01-01T01:00:00.000-08:00',
    department: 'Environment',
    budget: 45000,
  },
  {
    id: '6b41a4ed-6319-4c23-83c7-32eb5a655e7f',
    date: '2020-01-01T01:00:00.000-08:00',
    department: 'Transportation',
    budget: 32000,
  },
  // 22 more records
];