1.1.1 • Published 6 years ago
rudemock v1.1.1
rudeMock
rudeMock is a JavaScript package that is used to mock data
Usage:
API:
/* param is a object or json */
object = {
/*
*If the type of value you want is a number, 'key' is the key to the data needed,
*type should be 'number',minLength is the minimum length of the value of the key
*corresponding to the mock data,maxLength is *the same,'precision' is the number
*of decimal digits. Length may be omitted, add '!' set length fixed
*/
key: 'type|minLength-MaxLength|precision'
/*
*If the type of value you want is a string, the last parameter is different,
*which is used to determine whether there is any Chinese in the value.
*/
key2: 'type|minLength-MaxLength|openChinese'
}
/* It's easy to use */
const dataOfYouWant = rudeMock(object);
example:
const model = {
numberNoLimitLength: 'number||6',
stringLimitLength: 'string|10|true',
array: [{
string: 'string|1-9|true',
array2: [['number|6!','number||6']],
}]
};
rudeMock(model)