mock-plus is a encapsulation of mockjs, it will be more convenient to use mockjs with it.
- toDoc(input, output)
Aim to generate documentation to describe your interface
input: give the path of your json file
output: give the path where you wanna save the documentation
- toMock(input, output)
Aim to generate mock template
input: give the path of your josn file
output: give the paht where you wanna save the template
- generator(input, output)
Aim to generate mock data for testing
input: give the path of your json file
output: give the path where you wanna save the mock data
- config(ops)
Config the default rule for every type of data.
According to mockjs, the types include: boolean, integer, float, string, array, object. Visit mockjs for detail.
- getRule()
You can use this method to see what default rules you will use to generate the mock data.
####You should know:
- There is no default rules for array or object,
because that may cause some unexpected problems such as some attributes get lost.
so, be careful if you wanna add default rule for array or object.
based on mace、json-parser、mockjs