# fake-object

> - 👠 Seeding - "Boss: Now add a mock and integration tests. two minutes tops. Dev: Creates a User entity. Creates a Post entity. Creates an entity builder. Gives up on the job. Finds out about fake-object. - 👾 Testing - "Oh no, I have to set every nested

Latest version **1.0.4** (published 2024-01-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install fake-object
pnpm add fake-object
yarn add fake-object
bun add fake-object
```

## 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.4 |
| Published | 2024-01-21 |
| First published | 2024-01-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 654.3 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Or Shachar |
| Maintainers | orshachar |
| Keywords | fake-data, object-generation, data-mocking, typescript, testing-tools, mock-data, nested-objects, development-tools, data-simulation, javascript-utilities |

## Links

- npm: https://www.npmjs.com/package/fake-object
- Repository: https://github.com/orshachar/fake-object
- npm.io page: https://npm.io/package/fake-object

## Dependencies (2)

- [jaccard](https://npm.io/package/jaccard.md) ^0.4.0
- [@faker-js/faker](https://npm.io/package/@faker-js/faker.md) ^7.6.0

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 1.0.4 (latest) — 2024-01-21
- 1.0.2 — 2024-01-14
- 1.0.1 — 2024-01-14
- 1.0.0 — 2024-01-14

## README

<div align="center">
  <img src="./fake-object.png" width="200"/>
  <h1>Fake Object</h1>
  <p>Generate a faked object from another object for testing and seeding</p>
  
</div>



## 🚀 Why?

- 👠 Seeding - "Boss: Now add a mock and integration tests. two minutes tops.
                 Dev: Creates a User entity. Creates a Post entity. Creates an entity builder. Gives up on the job. Finds out about fake-object. 
- 👾 Testing - "Oh no, I have to set every nested property of this object, damn. Hey! I could use fake-object instead! Hooray!

> **Note**: The faked data does will not always be the best match for your property. It depends on whether 
> or not it is supported on faker js, or how well the property name resembles a faker function.

## 📦 Install

```bash
npm install --save-dev fake-object
```
```bash
yarn add dev fake-object
```
## 🪄 Usage

```ts
import { generateFakeObject } from 'fake-object';

const nestedObject = {
  name: 'John Doe',
  age: 30,
  address: {
    street: '123 Main St',
    city: 'Anytown',
    state: 'CA',
    country: 'USA'
  }
};

const fakeObject = generateFakeObject(nestedObject);
console.log(fakeObject);

// Do Something With the Fake Object

/* Generated Object
 {
      name: 'Narciso',
      age: '30294-3425',
      address: {
        street: 'Schowalter Highway',
        city: 'Gary',
        state: 'Florida',
        country: 'Svalbard & Jan Mayen Islands'
      }
    }

/*



```


## Contributing

  * Fork it! 
  * Create your feature branch: `git checkout -b my-new-feature` 
  * Commit your changes: `git commit -am 'Add some feature'` 
  * Push to the branch: `git push origin my-new-feature`
  * Submit a pull request!


## 🔑 License

[MIT](https://github.com/orshachar/fake-object/blob/main/LICENSE)

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