# mocko

> super simple schema based mock data generator. works integrated with fakerjs.

Latest version **0.0.3** (published 2023-03-31) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-03-31 |
| First published | 2023-03-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 8.2 KB |
| Known vulnerabilities | 0 (+2 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Author | cond |
| Maintainers | cond |
| Keywords | mock, mocker, mock data |

## Links

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

## Dependencies (5)

- [lodash.get](https://npm.io/package/lodash.get.md) ^4.4.2
- [lodash.set](https://npm.io/package/lodash.set.md) ^4.3.2
- [lodash.noop](https://npm.io/package/lodash.noop.md) ^3.0.1
- [lodash.unset](https://npm.io/package/lodash.unset.md) ^4.5.2
- [@faker-js/faker](https://npm.io/package/@faker-js/faker.md) ^7.6.0

## Alternatives

- [pagerjs](https://npm.io/package/pagerjs.md) — 60 weekly downloads
- [whistle.savefor-mock](https://npm.io/package/whistle.savefor-mock.md) — 4 weekly downloads
- [facebook-ads-library-api](https://npm.io/package/facebook-ads-library-api.md) — 0 weekly downloads
- [@comp-markdown/wireframe](https://npm.io/package/@comp-markdown/wireframe.md) — 0 weekly downloads
- [generador-datos-mx](https://npm.io/package/generador-datos-mx.md) — 0 weekly downloads

## Recent versions

- 0.0.3 (latest) — 2023-03-31
- 0.0.2 — 2023-03-31
- 0.0.1 — 2023-03-27

## README

# mocko

super simple schema based mock data generator. works integrated with fakerjs.

## Installation

```bash
npm i mocko
```

## Usage

the scheme runs entirely on fakerjs functions. You can check the faker api for more. https://fakerjs.dev/api/

```js
import mocko from 'mocko';

mocko({
  id: 'database.mongodbObjectId',
  name: 'name.fullName',
  photo: 'internet.avatar',
})
```

```json
{
  "id": "b0d11bd9f60fedcf6beee3fe",
  "name": "Bethany Lebsack III",
  "photo": "https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/688.jpg"
}
```

use of parameters

```js
import mocko from 'mocko';

mocko({
  phone: ['phone.number', '501-###-###'],
  texts: ['lorem.paragraphs', 5, '<br/>\n'],
})
```

```json
{
  "phone": "501-111-741",
  "texts": "Ratione animi corrupti deleniti molestias commodi architecto eligendi. Quaerat perspiciatis aliquam velit nostrum aspernatur. Veritatis provident facere nulla tenetur. Voluptates commodi illum laborum.
\nQuas voluptas commodi commodi quas deleniti quo minima. Voluptatibus quo nulla fugit quam sit. Eaque doloribus iusto minus animi distinctio beatae magni similique. Reiciendis quo a totam veritatis."
}
```

creating arrays

```js
import mocko from 'mocko';

mocko({
  'genres#5': 'music.genre',
  'colors#3': ['internet.color', 50, 50, 50],
})
```

```json
{
  "genres": [
    "Latin",
    "Metal",
    "Electronic",
    "Stage And Screen",
    "Non Music"
  ],
  "colors": [
    "#4e3c29",
    "#5b8321",
    "#744739"
  ]
}
```

mocko works in English by default. You can use changeLocale util to change locale.

https://fakerjs.dev/guide/localization.html#available-locales

```js
import mocko, { changeLocale } from 'mocko';

await changeLocale('tr')
```

## Contributing

Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.

Please make sure to update tests as appropriate.

## License

[MIT](https://choosealicense.com/licenses/mit/)

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