# mockuments

> Mock JSON Documents with funny defaults.

Latest version **0.0.3** (published 2020-09-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install mockuments
pnpm add mockuments
yarn add mockuments
bun add mockuments
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2020-09-20 |
| First published | 2020-09-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 10.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Sterpka |
| Maintainers | msterpka |
| Keywords | mock, json, documents |

## Links

- npm: https://www.npmjs.com/package/mockuments
- Repository: https://github.com/mster/mockuments
- Homepage: https://github.com/mster/mockuments#readme
- Issues: https://github.com/mster/mockuments/issues
- npm.io page: https://npm.io/package/mockuments

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.3 (latest) — 2020-09-20
- 0.0.2 — 2020-09-20
- 0.0.1 — 2020-09-20
- 0.0.0 — 2020-09-20

## README

# Mockuments

Mock JSON Documents with funny defaults.

Formerly [Socuments](https://github.com/mster/socuments).

![carbon](https://user-images.githubusercontent.com/15038724/93692886-7eb07080-faad-11ea-99ca-784f2188f26f.png)

## Usage

### **mockuments** ([ count, template ])

- **count**: &lt;Number&gt;<br>the number of mockuments to generate, defaulting to 10.

- **template**: &lt;Object&gt;<br>a mockuments template. See [templates](#templates) for more information on creating a custom template.

- **returns**: &lt;Array&gt;<br>An array of mockuments.

```js
const mocks = require("mockuments")();

const mocks100 = require("mockuments")(100);

const template = {
  firstName: { type: "name", length: "random" },
  lastName: { type: "name", length: 10 },
  lastLogin: { type: "date" },
  email: { type: "email" },
  loggedIn: { type: "boolean" },
};
const customMocks = require("mockuments")(10, template);
```

## Templates

To use your own template to generate Mockuments, simply supply a template object. Templates require a particular structure, requiring atleast a type field. Mockuments support some custom types along with many of the JS types.

### Default template

```js
{
  first: { type: 'name', max: 'rand' },
  middle: { type: 'letter', caps: true },
  last: { type: 'name', max: 'rand' },
  bio: {
    height: { type: 'height', max: 8 },
    age: { type: 'age', max: 100 },
    race: { type: 'race' },
    prey: { type: 'race' },
    bloodtype: { type: "choose", vals: [ "A", "...", "Unknown" ] },
    notes: { type: 'array', length: 'rand', content: 'lorem' }
  },
  contact: {
    onEarth: { type: 'boolean' },
    mobile: { type: 'phone' },
    email: { type: 'email' },
    password: { type: 'base64' },
    uuid: { type: 'uuid' },
    aliases: { type: 'array', length: 'rand', content: 'uuid' }
  },
  lastLogin: { type: 'date' },
  generatedBy: { type: 'passthrough', pass: 'npm:mockuments' }
}

```

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