{"id":27415467,"url":"https://github.com/suchjs/such","last_synced_at":"2025-04-14T09:27:16.244Z","repository":{"id":33484302,"uuid":"158650629","full_name":"suchjs/such","owner":"suchjs","description":"A powerful fake data library, expandable, configurable, generate data exactly as you want.","archived":false,"fork":false,"pushed_at":"2023-11-08T01:51:37.000Z","size":1529,"stargazers_count":29,"open_issues_count":8,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-11T19:43:08.512Z","etag":null,"topics":["data","fake","faker","generation","generator","javascript","json","json-data","mock","mocking","nodejs","simulate","simulation","typescript"],"latest_commit_sha":null,"homepage":"https://www.suchjs.com","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/suchjs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2018-11-22T06:12:56.000Z","updated_at":"2023-10-30T06:51:14.000Z","dependencies_parsed_at":"2023-11-08T06:47:55.564Z","dependency_job_id":"ca1012c4-209a-4656-ab2e-c305d726e405","html_url":"https://github.com/suchjs/such","commit_stats":{"total_commits":176,"total_committers":4,"mean_commits":44.0,"dds":0.6306818181818181,"last_synced_commit":"7d40cb8331ef025c7f62d88c31fb0d6681e58b59"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchjs%2Fsuch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchjs%2Fsuch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchjs%2Fsuch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suchjs%2Fsuch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suchjs","download_url":"https://codeload.github.com/suchjs/such/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248799713,"owners_count":21163398,"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":["data","fake","faker","generation","generator","javascript","json","json-data","mock","mocking","nodejs","simulate","simulation","typescript"],"created_at":"2025-04-14T09:27:10.626Z","updated_at":"2025-04-14T09:27:11.421Z","avatar_url":"https://github.com/suchjs.png","language":"TypeScript","readme":"\u003ch1 align=\"center\"\u003eSuchjs\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \n  ![Suchjs Logo](./source/image/logo.png)\n\n\u003c/div\u003e\n\u003cdiv align=\"center\"\u003e\n\n[![npm version](https://badge.fury.io/js/suchjs.svg)](https://badge.fury.io/js/suchjs)\u0026nbsp;\u0026nbsp;[![Build Status](https://travis-ci.com/suchjs/such.svg?branch=master)](https://travis-ci.com/suchjs/such)\u0026nbsp;\u0026nbsp;[![Coverage Status](https://coveralls.io/repos/github/suchjs/such/badge.svg)](https://coveralls.io/github/suchjs/such)\n\n\u003c/div\u003e\n\nAn expandable and powerful library for generating fake data, both in nodejs \u0026 browser envirionment. You can use it to build a mock data server in nodejs, or just mocking data locally in the browser, normal built-in types can seen in [official site](https://www.suchjs.com/?locale=en-US), more extended types can seen in the [document](https://suchjs.github.io/vp-suchjs/en/extTypes.html), you can start it easily.\n\n## Installation\n\n[How to install](https://suchjs.github.io/vp-suchjs/en/installation.html)\n\n## Online demos\n\n```javascript\nimport globalSuch from 'suchjs';\n// assign a city data\nglobalSuch.assign('city', {\n  BeiJing: {\n    BeiJing: ['ChaoYang', 'HaiDian', 'DongCheng'],\n  },\n  ShangHai: {\n    ShangHai: ['JingAn', 'PuDong', 'PuTuo'],\n  },\n  GuangZhou: {\n    GuangZhou: ['PanYu', 'YueXiu', 'BaiYun'],\n  },\n});\n// assign a type 'mobile$china' base on 'regexp' type\nglobalSuch.define(\n  'mobile$china',\n  'regexp',\n  '/(\\\\+86-)?(?\u003cservice\u003e1[3-8][0-9])\\\\d{8}/',\n);\n// assign a type 'who' as an enum type\nglobalSuch.define('who', [\"I'm\", \"He's\", \"She's\"]);\nconsole.log(globalSuch.as({\n  string: \":string:[65,121]:{10,20}:@concat('_suffix')\",\n  number: ':number:[100,200]:%.2f',\n  date: \":date:['-1 week','+1 week']:%yyyy-mm-dd HH\\\\:MM\\\\:ss\",\n  regexp: ':regexp:/[a-z]{1,3}[0-9]{2,10}/',\n  range: ':increment:{2,3}:#[start=2,step=3]',\n  'menu{2}': {\n    id: ':increment',\n    title: ':uppercase:{5,10}',\n    'childs{2}': {\n      cid: ':increment',\n      refPid: ':ref:\u0026../id',\n      title: ':lowercase:{5,10}',\n    },\n  },\n  cascader: {\n    province: ':cascader:#[root=true,data=city]',\n    city: ':cascader:\u0026./province',\n    area: ':cascader:\u0026./city',\n  },\n  'enum:{1}': ['one', 'two'],\n  template:\n    ':::`:who` coming from `:ref:\u0026./cascader/province`-`:ref:\u0026./cascader/city`-`:ref:\u0026./cascader/area`',\n  diy: ':mobile$china',\n  escape: '\\\\:number',\n  extends: {\n    bool: ':bool',\n    int: ':int',\n    percent: ':percent',\n    uppercase: ':uppercase:{2,4}',\n    lowercase: ':lowercase:{2,4}',\n    alpha: ':alpha:{3,6}',\n    alphaNumeric: ':alphaNumeric:{3,6}',\n    alphaNumericDash: ':alphaNumericDash:{3,6}',\n    tld: ':tld',\n    domain: ':domain',\n    protocol: ':protocol',\n    url: ':url',\n    email: \":email:#[domain='163.com']\",\n    ipv4: ':ipv4',\n    ipv6: ':ipv6',\n    color$hex: ':color$hex',\n    color$rgb: ':color$rgb',\n    color$rgba: ':color$rgba',\n    color$hsl: ':color$hsl',\n    color$hsla: ':color$hsla',\n  },\n}));\n```\n\n[Playground](https://suchjs.github.io/vp-suchjs/en/playground.html)\n\n## Changelog\n\n[Changelog](./CHANGELOG.md)\n\n## Expandable \u0026 Powerful\n\nSuchjs has powerful APIs for you to [design your own data](https://suchjs.github.io/vp-suchjs/en/api.html#such-define), you can use a template literal mixed normal string and all supported data types to generate a DIY string just like an article. A built-in recommend extend types can be seen in [such:recommend](./src/extends/recommend.ts)\n\n## Questions \u0026 Bugs?\n\nWelcome to report to us with [issue](https://github.com/suchjs/such/issues) if you meet any question or bug.\n\n## License\n\n[MIT License](./LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuchjs%2Fsuch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuchjs%2Fsuch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuchjs%2Fsuch/lists"}