# fancy-data

> JavaScript mockup data generation library

Latest version **1.0.1** (published 2018-10-11) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-10-11 |
| First published | 2018-10-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 193.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | FancyGrid |
| Maintainers | fancygrid |
| Keywords | fancydata, data, generation, javascript, html5 |

## Links

- npm: https://www.npmjs.com/package/fancy-data
- npm.io page: https://npm.io/package/fancy-data

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-10-11
- 1.0.0 — 2018-10-11

## README

# FancyData

FancyData - JavaScript Mockup Data Generation Library

## *Install*
```
npm install fancy-data
```
  
## *Include*
```
<script src="/dist/bundle.min.js"></script>
```
  
### *CDN*
```
<script src="https://cdn.fancygrid.com/fancydata.min.js"></script>
```

#### *Sample*
```js
new FancyData({
  rows: 1000000,
  indexes: ['id', 'name', 'surname', 'country', 'position', 'email', 'age'],
  columns: [{
    type: 'id',
    index: 'id'
  },{
    type: 'name',
    index: 'name'
  },{
    type: 'surname',
    index: 'surname'
  },{
    type: 'country-rich',
    index: 'country'
  },{
    type: 'it-position',
    index: 'position'
  },{
    type: 'email',
    index: 'email',
    site: 'google.com'
  },{
    type: 'age',
    min: 20,
    max: 45,
    index: 'age'
  }]
}).getData({
  on1000: function(generated, percents, total){
    console.log(generated, percents, total)
  },
  onFinished: function(data){
    console.log('onFinished', data);
  }
});
```
  
### *Core Properties*
| Name | Type | Description |
| --- | --- | --- |
| `columns` | Array | List with columns config |
| `indexes` | Array | Data indexes, if not provided than it data could contain more options than columns |
| `rows` | Number | Number of data rows |

### *Column types*

#### *age*
 Age range value from min and max values.  
By default min is 0 and max is 100.  

##### *Properties*

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `max` | Number |
| `min` | Number |

##### *Sample*
```
{
  type: 'age',
  min: 20,
  max: 45,
  index: 'age'
}
```

#### *boolean*
Boolean value true or false.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'boolean',
  index: 'married'
}
```

#### *company*
Random company from small list.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'company',
  index: 'company'
}
```

#### *country*
Random country from almost all countries list.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'country',
  index: 'country'
}
```

#### *country-rich*
Random rich country.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'country-rich',
  index: 'country'
}
```

#### *date*
Date value in format 'm.d.Y' by default between min 1970.1.1 and current date.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `format` | String |
| `min` | Number |
| `max` | Number |

##### Sample
```
{
  type: 'date',
  index: 'birthday',
  format: 'm/d/Y',
  min: new Date(1980, 1, 7)
}
```

#### *email*
 Person email on base of 'name', 'surname', 'site'.
'site' is column property but name and surname must be extra columns.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `tpl` | String |
| `site` | Number |
| `max` | Number |

##### Sample
```
{
  type: 'email',
  index: 'email',
  site: 'google.com'
}
```

#### *float*
 Float number value with presition between range.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `presition` | Number |
| `min` | Number |
| `max` | Number |

##### Sample
```
{
  type: 'float',
  index: 'bank_balance',
  presition: 2,
  min: 0,
  max: 150000
}
```

#### *fortune100*
 Company from fortune 100 list.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'fortune100',
  index: 'company'
}
```

#### *fortune500*
 Company from fortune 500 list.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'fortune500',
  index: 'company'
}
```

#### *gender*
 Person gender, possible values: 'male'|'female'.  
Requires extra column name.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'fortune500',
  index: 'company'
}
```

#### *id*
 Incremental id value start from 1 by default.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `min` | Number |

##### Sample
```
{
  type: 'fortune500',
  index: 'company'
}
```

#### *int*
 Integer number value between range.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `min` | Number |
| `max` | Number |

##### Sample
```
{
  type: 'int',
  index: 'value',
  min: 1000,
  max: 100000
}
```

#### *it-level*
 Proffesional person level.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'it-level',
  index: 'level'
}
```

#### *it-position*
 Person position in tech sphere.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'it-level',
  index: 'level'
}
```

#### *name*
 Person name.
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'name',
  index: 'name'
}
```

#### *salary-year*
 Person salary per year in range
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |
| `min` | Number |
| `max` | Number |

##### Sample
```
{
  type: 'salary-year',
  index: 'salary'
}
```

#### *surname*
 Person surname
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'surname',
  index: 'surname'
}
```

#### *usa-state*
 Random USA state
##### Properties

| Name | Type |
| --- | --- |
| `type` | String |
| `index` | String |

##### Sample
```
{
  type: 'usa-state',
  index: 'state'
}
```

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