Coder Social home page Coder Social logo

mock's Introduction

A Simple data mock library

Example

const mocked = multi(10, () =>
  mockObj({
    name: [
      "func",
      () =>
        mockName("周吴郑王林", 1, 1) + mockName("风林火山水道德法徐可欣", 1, 2),
    ],
    age: ["num", [18, 26]],
    gender: ["list", ["男", "女"]],
    userName: ["name", ["abcdefghijklmnopqrstuvwxyz_", 5, 8]],
  })
);

Output

[
  { name: "周欣林", age: 22, gender: "男", userName: "jvugpeq" },
  { name: "周火火", age: 25, gender: "男", userName: "vsnxhv" },
  { name: "吴可", age: 24, gender: "男", userName: "swqnuhps" },
  { name: "王林", age: 21, gender: "男", userName: "_vubf" },
  { name: "林徐可", age: 19, gender: "女", userName: "hkszyjfm" },
  { name: "郑德", age: 21, gender: "女", userName: "tpztfze" },
  { name: "林林徐", age: 19, gender: "女", userName: "npulxm" },
  { name: "郑德风", age: 20, gender: "男", userName: "mzoel" },
  { name: "林风徐", age: 21, gender: "男", userName: "wdwuto" },
  { name: "王风风", age: 18, gender: "男", userName: "mldae" }
]

mock's People

Contributors

lidessen avatar

Stargazers

Roman avatar

Watchers

 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.