Code Monkey home page Code Monkey logo

better-mock's Introduction

Build Status Coverage Status npm NPM npm type-coverage

介绍

better-mock fork 自 Mock.js,使用方法和 Mock.js 一致,用于 javascript mock 数据生成,它可以拦截 XHRfetch 请求,并返回自定义的数据类型。并且还支持主流小程序(微信、支付宝、头条、百度)。

文档介绍

更新日志

为什么有 Better-Mock ?

Mock.js 是一个很好的库,国内使用者众多,虽然该库几乎已经停止维护了,但是还是有很多使用者在提 issue 和 PR,这些问题都得不到有效的解决。而且在当前时代下,Mock.js 的构建工具、代码质量都显得很陈旧,所以 better-mock 将会在 Mock.js 的基础上进行迭代,持续修复 Mock.js 的众多issue,支持更多的新特性。

特点

  • 100% 兼容 Mock.js
  • 使用 typescript 进行重构,更好的代码提示。
  • 更加现代化的构建打包方案。
  • 更加完善的单元测试。
  • 支持对 fetch 的拦截。
  • 支持主流小程序(微信、支付宝、头条、百度)。

安装

npm install better-mock

使用

使用 better-mock 代替 mockjs

const Mock = require('better-mock')
Mock.mock({
  'list|1-10': [{
    'id|+1': 1
  }]
})

贡献指南

如果你想贡献自己的代码到 better-mock,请先仔细阅读这份贡献指南

License

Mock.js is available under the terms of the MIT License.

better-mock's People

Contributors

lavyun avatar limjcst avatar mocobk 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.