Created
May 28, 2021 15:21
-
-
Save WitkowskiMichau/acbccc5e2d83110878e8981f943ba8e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Chance = require('chance') | |
const chance = new Chance('user-admin-mock-data') | |
const generateUser = (id) => ({ | |
id: chance.guid(), | |
name: chance.name() | |
}) | |
const generateUsers = () => ids.map(generateUser) | |
module.exports = (db = null) => { | |
const users = generateUsers() | |
if (db) { | |
const updateDB = (key, data) => db.get(key).push(...data).write() | |
updateDB('users', users) | |
} | |
return { | |
users | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment