Shoulder.dev Logo Shoulder.dev

@ngneat/falso - gothinkster/node-express-realworld-example-app

Go to Shoulder Page

Why Use @ngneat/falso?

@ngneat/falso is an essential tool for developers who need to create and test applications with realistic data. It's particularly useful when working on large projects or when dealing with complex data structures.

Installation

To start using @ngneat/falso in your project, follow these steps:

  1. Install the package using npm or yarn:

    npm i @ngneat/falso
    

    or

    yarn add @ngneat/falso
    

Usage

Import the required functions from @ngneat/falso and use them to generate fake data:

import { randEmail, randFullName } from '@ngneat/falso';

const user = {
  email: randEmail(),
  name: randFullName()
};

const emails = randEmail({ length: 10 });

You can also specify the length of elements you want to generate:

const emails = randEmail({ length: 10, maxCharCount: 20 });

Setting a Randomness Seed

If you want consistent results, you can set your own seed:

import { rand, seed } from '@ngneat/falso';

seed('some-constant-seed');

// Always returns 2
rand([1, 2, 3, 4, 5]);

// Reset random seed
seed();

For more information and to learn about other features, visit the docs site.

Sponsorship

Consider sponsoring @ngneat/falso to support its continued development and maintenance. Visit the sponsorship page for more information.

StackBlitz

You can also use @ngneat/falso in StackBlitz for quick testing and experimentation.

For more details on contributing to the project, check out the contribution guide.