0.4.2 • Published 3 years ago

node-factory v0.4.2

Weekly downloads
1,195
License
MIT
Repository
github
Last release
3 years ago

Node Factory

version issues issues

When developing or testing your application, you might need to mock data comming from a database or an endpoint. Instead of manually generating "random" data, you can use model factories. This package allows you to define a default set of attributes for each of your endpoints or models and easily mock responses.

Docs

Check out our documentation for APIs and examples at https://olavoasantos.github.io/node-factory/

Installation

If you're using yarn:

yarn add -D node-factory

Or, if you're using npm:

npm install --save-dev node-factory

Usage

// 1. Import the factory generator
import { factory } from 'node-factory';

// 2. Create a factory
interface User {
  id: string;
  name: string;
  email: string;
}

const UserFactory = factory<User>(fake => ({
  id: fake.datatype.uuid(),
  name: fake.name.findName(),
  email: fake.internet.email(),
}));

// 3. Generate data
UserFactory.make();

Author

0.4.2

3 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.10

4 years ago

0.3.9

4 years ago

0.3.8

4 years ago

0.3.6

4 years ago

0.3.7

4 years ago

0.3.5

4 years ago

0.3.4

4 years ago

0.3.3

4 years ago

0.3.2

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago

0.2.6

5 years ago

0.2.5

5 years ago

0.2.4

5 years ago

0.2.3

5 years ago

0.2.2

5 years ago

0.2.1

5 years ago

0.2.0

5 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago