npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

better-mock

v0.3.7

Published

Forked from Mockjs. Generate random data & Intercept ajax request. Support miniprogram.

Downloads

862

Readme

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.