Code Monkey home page Code Monkey logo

blueprint's Introduction

Blueprint

TypeScript Jest prettier GitHub license GitHub issues GitHub stars

Blueprint is a versatile random data generator inspired by the simplicity and power of Zod. With Blueprint, you can effortlessly create mock data for your applications, tests, or any other use case where realistic yet customizable data is needed.

Features

Easy-to-use syntax: Define your data structures with a simple and intuitive syntax, making it easy to generate data according to your specifications.

Flexible customization: Tailor your data generation with a wide range of options, including data types, constraints, and relationships between data fields.

Built-in data types: Blueprint supports a variety of common data types such as strings, numbers, dates, and more, allowing you to generate diverse datasets.

Extensible: Extend Blueprint with custom data types and generators to suit your specific requirements.

Installation

You can install Blueprint via npm:

npm install --save-dev @cicerotcv/blueprint

Using yarn

yarn add -D @cicerotcv/blueprint

Or pnpm

pnpm add -D @cicerotcv/blueprint

Usage

import { b } from '@cicerotcv/blueprint';

const objectSchema = b.schema({
  age: b.integer.between({
    min: 0,
    max: 10,
  }),
});

const array = b.array({
  length: 3,
  schema: objectSchema,
});

console.log(array.generate());
// [{ age: 2 }, { age: 3 }, { age: 5 }]

Contributing

Contributions are welcome! Please see our contribution guidelines for more information on how to get involved.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Blueprint draws inspiration from Zod. We are grateful to the contributors of Zod for their fantastic work.

blueprint's People

Contributors

cicerotcv avatar github-actions[bot] avatar

Watchers

 avatar

blueprint's Issues

Revamp of Random Data Generator: Help Wanted

Introduction

We're seeking contributors to join us in the exciting overhaul of our random data generator library, previously built on top of faker-js. In this rewrite, we're striving to enhance performance, flexibility, and maintainability by reconstructing all data generators from scratch. Here's why you should get involved:

Benefits of the Rewrite

  1. Independence from External Libraries: By removing the dependency on faker-js, we achieve greater control over the functionality and performance of our random data generation. This independence allows us to tailor the library precisely to our needs and streamline its operation.

  2. Customization at Its Core: With the new implementation, we're introducing an array of customization options right at the core of the generator functions. Users will have more granular control over the generated data, enabling them to fine-tune parameters to suit their specific use cases.

  3. Enhanced Documentation and Support: Alongside the code rewrite, we're committed to improving documentation and providing comprehensive support resources. Clearer explanations, detailed examples, and an active community will ensure a smooth transition for both existing and new users of the library.

How You Can Contribute:

We're looking for passionate developers who share our vision for a robust, versatile, and user-friendly random data generation tool. Whether you're keen on diving into the codebase, contributing to documentation, or providing feedback and testing, there's a place for you here.

Together, let's build a library that empowers developers worldwide to create realistic, customizable datasets with ease.

Ready to contribute? Head over to our GitHub repository and get involved today!

Sample Usage (Updated):

import { Blueprint as Bp } from '@cicerotcv/blueprint'

// Describe schemas without faker-js dependency
const dateSchema = Bp.date
  .between("2000-01-01", "2022-12-31")
  .transform((date) => date.toISOString());

const idSchema = Bp.datatype.uuid();

const emailSchema = Bp.internet.email()

// Combine schemas into an ObjectSchema
const userSchema = Bp.object({
  id: idSchema,
  createdAt: dateSchema,
  email: emailSchema,
});

// Generate an array of items of the same kind
const userCollection = Bp.array({
  minLength: 1,
  maxLength: 4,
  schema: userSchema,
});

// Compile and generate the items
console.log(userCollection.compile());

Conclusion:

Our rewrite of the random data generator library represents a significant step forward in terms of flexibility, performance, and user empowerment. Join us on this journey to create a tool that meets the diverse needs of developers across various domains.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.