package
Struct fake json data smoothly
npm install masloGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Simple JSON fake data creation.
$ npm install maslo --save-devProbably you will want to use faker.js.
$ npm install faker --save-devor chancejs.
$ npm install chance --save-devAll examples uses faker.js.
import faker from 'faker';
import {
shape,
bool,
oneOf,
arrayOf,
optional
} from 'maslo';
const fakeUserSchema = shape({
id: faker.random.uuid,
name: faker.name.findName,
description: optional(() => 'description'),
isAdmin: bool(),
status: oneOf(['slave', 'master']),
posts: arrayOf(shape({
id: faker.random.uuid,
title: faker.name.findName
}), 1, 5)
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.
Returns a function, which returns true or false.
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.
Returns a function, which returns one of provided array value.
Returns a function, which returns function's result or special @@OPTIONAL value. Shape will remove all @@OPTIONAL values from himself.
MIT © Aleksandr Yakunichev