A very simple generator of mock data
<field1>:<field1_type=number|string|null|bool|bool!|array(<len>)|object{prop1:number|string|array|object, prop2:number|string|null|bool|bool!|array|object}>[,<field2>:<field2_type=number|string|null|bool|bool!|array|object>]
const mock = require('seed-mock');
const seed= 'name:string,category:array(5)[number],data:object{name:string,age:number},count:number';
console.log(mock(seed));
For more examples, please refer to test.js
-
Generating mock data from seed schema
seed-mock -s name:string,category:array(5)[number],data:object{name:string,age:number},count:number
-
Pretty output data with
-pretty [spaces]
or-p [spaces]
or-p
- [spaces]: JSON spaces, default is 2
-
Write the output data to local file with
-output <file path>
- 2019-07-12 00:06:45
- Add supports for
undefined
,bool
,bool!
andnull
type - Add supports for
array(5)[number|string|....]
、object{field:number, field2:string....}
andstring
、null
、bool
、bool!
those formats for generating mock directly
- Add supports for