All Projects → hustcc → miz

hustcc / miz

Licence: MIT license
🎯 Generate fake data, Just like a person.

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to miz

Faker
Go (Golang) Fake Data Generator for Struct
Stars: ✭ 1,698 (+6975%)
Mutual labels:  faker, mock-data, fake-data
mock-data
Mock data in PostgreSQL/Greenplum databases
Stars: ✭ 115 (+379.17%)
Mutual labels:  mock, mock-data, fake-data
Morphlingjs
A CLI to mock with meaningful data a REST API from a Swagger file
Stars: ✭ 148 (+516.67%)
Mutual labels:  mock, faker
Graphql Faker
🎲 Mock or extend your GraphQL API with faked data. No coding required.
Stars: ✭ 2,361 (+9737.5%)
Mutual labels:  mock, faker
Mockoon
Mockoon is the easiest and quickest way to run mock APIs locally. No remote deployment, no account required, open source.
Stars: ✭ 3,448 (+14266.67%)
Mutual labels:  mock, mock-data
ng-apimock
Node plugin that provides the ability to use scenario based api mocking: for local development for protractor testing
Stars: ✭ 102 (+325%)
Mutual labels:  mock, mock-data
Mimesis
Mimesis is a high-performance fake data generator for Python, which provides data for a variety of purposes in a variety of languages.
Stars: ✭ 3,439 (+14229.17%)
Mutual labels:  mock, faker
Faker
Provides fake data to your Android apps :)
Stars: ✭ 234 (+875%)
Mutual labels:  mock, faker
Faker.js
generate massive amounts of realistic fake data in Node.js and the browser
Stars: ✭ 34,329 (+142937.5%)
Mutual labels:  faker, fake-data
interface-forge
Graceful mock-data and fixtures generation using TypeScript
Stars: ✭ 58 (+141.67%)
Mutual labels:  mock, mock-data
mockingbird
🐦 Decorator Powered TypeScript Library for Creating Mocks
Stars: ✭ 70 (+191.67%)
Mutual labels:  mock, faker
Paw-FakerDynamicValue
A dynamic value extension for Paw using Faker to generate data
Stars: ✭ 16 (-33.33%)
Mutual labels:  mock, faker
better-mock
Forked from Mockjs, Generate random data & Intercept ajax request. Support miniprogram.
Stars: ✭ 140 (+483.33%)
Mutual labels:  mock, mock-data
Mockaco
🐵 HTTP mock server, useful to stub services and simulate dynamic API responses, leveraging ASP.NET Core features, built-in fake data generation and pure C# scripting
Stars: ✭ 213 (+787.5%)
Mutual labels:  mock, faker
Fakerator
Random fake data generator with localization for Javascript in Node.js and browser
Stars: ✭ 91 (+279.17%)
Mutual labels:  mock, faker
Node Mock Server
File based Node REST API mock server
Stars: ✭ 225 (+837.5%)
Mutual labels:  mock, faker
random
Random data generator AKA faker
Stars: ✭ 14 (-41.67%)
Mutual labels:  faker, fake-data
faker
A set of javascript packages that generates fake data for you.
Stars: ✭ 33 (+37.5%)
Mutual labels:  faker, fake-data
fe-dev-server
FE Dev Server target to help frontend web developers create view template, styles and js easily.
Stars: ✭ 30 (+25%)
Mutual labels:  mock, mock-data
factory
Generate lots of mock API data with ease.
Stars: ✭ 17 (-29.17%)
Mutual labels:  mock, mock-data

miz

(< 800b) Generate fake / mock structured variable in a modern, human-readable way. Just like a person.

用一个现代的、可读的方式来生成用于测试的假数据。

npm Version Build Status Coverage Status npm License

Features

⚡️ Simple but highly perfection API
🐣 Tiny footprint (< 800b)
👓 Customize
🎃 3 types of bundles exposed: ESM, CJS and UMD
🔥 TypeScript Typings readily available
🎸 Browser and NodeJs supported
🎯 End-to-end testing with GitHub Action

Install

$ npm i --save miz

Usage

import { M } from 'miz'; // ES6

const m = M.arrayOf(M.shape({
  id: M.number(10000, 1000000),     	// id is between 10000 ~ 1000000.
  name: M.string(6),                	// 6 length random string.
  sex: M.bool(),                    	// random true or false.
  city: M.constant('hz'),          	 	// constant value.
  work: M.oneOf(['QA', 'FED'])      	// random from array
}), 2);                               // list length is 2.

m.mock();

Then will get the mock variable like below:

[{
	id: 757852,
	name: 'mU7RTB',
	sex: false,
	city: 'hz',
	work: 'FED'
}, {
	id: 359987,
	name: 'jWuKxX',
	sex: true,
	city: 'hz',
	work: 'FED'
}]

API & Mocker

You can assemble the variable structure arbitrarily by using the mockers below:

  • M.bool()
M.bool().mock(); // true
  • M.number(min[, max = min, fixed = 0])
M.number(1, 9, 2).mock(); // 4.71
  • M.string([len = 8])
M.string(6).mock(); // `Qv_teE`
  • M.constant(value)
M.constant('hello, hustcc.').mock(); // `hello, hustcc`
M.constant(null).mock(); // got null
  • M.oneOf(valueArray)
M.oneOf(['hustcc', 'imcxl']).mock(); // hustcc
  • M.arrayOf(mocker[, min = 20, max = min])
// got an array which contains string, and array length 10 ~ 20.
M.arrayOf(VT.string(4), 10, 20);.mock(); 
  • M.shape(mockerObject)
// random value object.
M.shape({
  name: M.string(10),
  id: M.number(10000, 1000000),
  sex: M.bool(),
  city: 'hz',
}).mock();
  • M.apply(Function)
// will got number generate by fucntion Math.random()
M.apply(() => Math.random()).mock(); 

More Mocker needed, welcome to send a pull request, or put an issue to me.

License

ISC@hustcc.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].