{"id":13672855,"url":"https://github.com/hustcc/miz","last_synced_at":"2025-03-19T14:30:40.638Z","repository":{"id":57298664,"uuid":"103488040","full_name":"hustcc/miz","owner":"hustcc","description":"🎯 Generate fake data for finetune of AI, Just like a person.","archived":false,"fork":false,"pushed_at":"2024-04-07T07:05:54.000Z","size":12,"stargazers_count":23,"open_issues_count":2,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-17T07:51:28.302Z","etag":null,"topics":["fake-data","faker","finetune","finetune-llm","mocker"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hustcc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://paypal.me/hustcc","https://atool.vip"]}},"created_at":"2017-09-14T05:04:03.000Z","updated_at":"2024-12-25T09:08:22.000Z","dependencies_parsed_at":"2024-06-19T00:24:22.980Z","dependency_job_id":"d0478c80-4574-487a-8149-7e78065b844d","html_url":"https://github.com/hustcc/miz","commit_stats":{"total_commits":5,"total_committers":1,"mean_commits":5.0,"dds":0.0,"last_synced_commit":"eaab8f9301c42008cb2149d57199df6555bef147"},"previous_names":["hustcc/mock-variable"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fmiz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fmiz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fmiz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hustcc%2Fmiz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hustcc","download_url":"https://codeload.github.com/hustcc/miz/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244444443,"owners_count":20453726,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fake-data","faker","finetune","finetune-llm","mocker"],"created_at":"2024-08-02T09:01:52.401Z","updated_at":"2025-03-19T14:30:40.357Z","avatar_url":"https://github.com/hustcc.png","language":"TypeScript","funding_links":["https://paypal.me/hustcc","https://atool.vip"],"categories":["TypeScript"],"sub_categories":[],"readme":"# miz\n\n\u003e (\u003c 800b) Generate fake / mock structured variable in a modern, human-readable way. Just like a person.\n\u003e\n\u003e 用一个现代的、可读的方式来生成用于测试的假数据。\n\n[![npm Version](https://img.shields.io/npm/v/miz.svg)](https://www.npmjs.com/package/miz)\n[![Build Status](https://github.com/hustcc/miz/workflows/build/badge.svg)](https://github.com/hustcc/miz/actions)\n[![Coverage Status](https://coveralls.io/repos/github/hustcc/miz/badge.svg?branch=master)](https://coveralls.io/github/hustcc/miz?branch=master)\n[![npm License](https://img.shields.io/npm/l/miz.svg)](https://www.npmjs.com/package/miz)\n\n\n## Features\n\n⚡️  Simple but highly perfection API  \n🐣 Tiny footprint (\u003c 800b)  \n👓 Customize  \n🎃 3 types of bundles exposed: ESM, CJS and UMD  \n🔥 TypeScript Typings readily available  \n🎸 Browser and NodeJs supported  \n🎯 End-to-end testing with GitHub Action  \n\n\n## Install\n\n```bash\n$ npm i --save miz\n```\n\n\n## Usage\n\n```ts\nimport { M } from 'miz'; // ES6\n\nconst m = M.arrayOf(M.shape({\n  id: M.number(10000, 1000000),     \t// id is between 10000 ~ 1000000.\n  name: M.string(6),                \t// 6 length random string.\n  sex: M.bool(),                    \t// random true or false.\n  city: M.constant('hz'),          \t \t// constant value.\n  work: M.oneOf(['QA', 'FED'])      \t// random from array\n}), 2);                               // list length is 2.\n\nm.mock();\n```\n\nThen will get the mock variable like below:\n\n```ts\n[{\n\tid: 757852,\n\tname: 'mU7RTB',\n\tsex: false,\n\tcity: 'hz',\n\twork: 'FED'\n}, {\n\tid: 359987,\n\tname: 'jWuKxX',\n\tsex: true,\n\tcity: 'hz',\n\twork: 'FED'\n}]\n```\n\n\n## API \u0026 Mocker\n\nYou can assemble the variable structure arbitrarily by **using the mockers** below:\n\n - **M.bool()**\n\n```ts\nM.bool().mock(); // true\n```\n\n - **M.number(min[, max = min, fixed = 0])**\n\n```ts\nM.number(1, 9, 2).mock(); // 4.71\n```\n\n - **M.string([len = 8])**\n\n```ts\nM.string(6).mock(); // `Qv_teE`\n```\n\n- **M.constant(value)**\n\n```ts\nM.constant('hello, hustcc.').mock(); // `hello, hustcc`\nM.constant(null).mock(); // got null\n```\n\n - **M.oneOf(valueArray)**\n\n```ts\nM.oneOf(['hustcc', 'imcxl']).mock(); // hustcc\n```\n\n - **M.arrayOf(mocker[, min = 20, max = min])**\n\n```ts\n// got an array which contains string, and array length 10 ~ 20.\nM.arrayOf(VT.string(4), 10, 20).mock(); \n```\n\n - **M.shape(mockerObject)**\n\n```ts\n// random value object.\nM.shape({\n  name: M.string(10),\n  id: M.number(10000, 1000000),\n  sex: M.bool(),\n  city: 'hz',\n}).mock();\n```\n \n - **M.apply(Function)**\n\n```ts\n// will got number generate by fucntion Math.random()\nM.apply(() =\u003e Math.random()).mock(); \n```\n\n\u003e More `Mocker` needed, welcome to `send a pull request`, or put an issue to me.\n\n\n## License\n\nISC@[hustcc](https://github.com/hustcc).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fmiz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhustcc%2Fmiz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhustcc%2Fmiz/lists"}