28b11e6fed
refs: https://github.com/TryGhost/Toolbox/issues/440 New command to generate demo data, creates data for over 20 tables in Ghost, suitable for testing most features of the dashboard, as well as making guided product tours using newsletters, tiers, many posts and tags. Usage: `yarn start generate-data` Optionally, keep your existing posts / tags with: `yarn start generate-data --use-existing-tags --use-existing-posts`
14 lines
378 B
JavaScript
14 lines
378 B
JavaScript
const {faker} = require('@faker-js/faker');
|
|
|
|
/**
|
|
* Adds another degree of randomness into some decisions
|
|
* @param {number} lowerThan Only this % of people will achieve this luck
|
|
* @returns {boolean} Whether this person is lucky enough for the condition
|
|
*/
|
|
const luck = lowerThan => faker.datatype.number({
|
|
min: 1,
|
|
max: 100
|
|
}) <= lowerThan;
|
|
|
|
module.exports = {luck};
|