Giter Site home page Giter Site logo

mock.macro's Introduction

mock.macro

Welcome! This project is mainly used to demonstrate how to create a babel macro. Of course if you think this project may help you or if you have idea to make it better, let's talk about it!

this is a macro (read about babel-plugin-macros if you are not familiar) to generate mock data using type system.

Example Usage

// @flow
import type { mock } from 'mock.macro';

async function foo(): mock<{ id: number, name: string }> {
  // TODO: implement
  return fetch('api/not/ready');
}

// somewhere else
const response = await foo();
console.log(response); 
/* { id: 4916, name: 'Sausages' } */

Prior Art

Manta Style - Mock server that converts type definitions into mock data

mock.macro's People

Contributors

tanhauhau avatar

Stargazers

Roman avatar  avatar Shen Chao avatar Drazen Bjelovuk avatar JSupot avatar Medson Oliveira avatar

Watchers

James Cloos avatar  avatar Drazen Bjelovuk avatar

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.