# data-spring

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

Latest version **0.1.11** (published 2020-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install data-spring
pnpm add data-spring
yarn add data-spring
bun add data-spring
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.11 |
| Published | 2020-12-22 |
| First published | 2020-10-12 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 2 |
| Unpacked size | 36.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | tylerben |
| Maintainers | tylerben |
| Keywords | data, data generator, fake data, typescript, javascript, data-spring, generator, mock data, mock, dummy data, dummy, dashboard, data visualization |

## Links

- npm: https://www.npmjs.com/package/data-spring
- Repository: https://github.com/tylerben/data-spring
- Homepage: https://github.com/tylerben/data-spring#readme
- Issues: https://github.com/tylerben/data-spring/issues
- npm.io page: https://npm.io/package/data-spring

## Dependencies (2)

- [uuid](https://npm.io/package/uuid.md) ^8.3.1
- [luxon](https://npm.io/package/luxon.md) ^1.25.0

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.1.11 (latest) — 2020-12-22
- 0.1.10 — 2020-12-22
- 0.1.9 — 2020-12-22
- 0.1.8 — 2020-12-18
- 0.1.7 — 2020-12-18
- 0.1.5 — 2020-12-18
- 0.1.4 — 2020-10-12
- 0.1.3 — 2020-10-12
- 0.1.0 — 2020-10-12

## 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.

```shell
# 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).

```js
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...

```js
[
  {
    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
];
```

---
_Source: https://npm.io/package/data-spring · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
