Maslo
Simple JSON fake data creation.
Installation
$ npm install maslo --save-dev
Probably you will want to use faker.js.
$ npm install faker --save-dev
or chancejs.
$ npm install chance --save-dev
Usage
All examples uses faker.js
.
ES6
;; const fakeUserSchema = ; const fakeUserJSON = ;
Api
shape(Object)
Returns a function, which iterates on a provided object's keys and calls them (in case of the key is a function
) or just returns it's value.
bool()
Returns a function
, which returns true
or false
.
arrayOf(Array, [min, max])
Returns a function, which iterates on a provided array's values and calls them (in case of the value is a function
) or just returns it's value.
min Type: Number
Min length of generated array. Default: 5
;
max Type: Number
Max length of generated array.
oneOf(Array)
Returns a function, which returns one of provided array value.
optional(Function)
Returns a function, which returns function's result or special @@OPTIONAL
value. Shape
will remove all @@OPTIONAL
values from himself.
License
MIT © Aleksandr Yakunichev