Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const makeComments = (db, post, count) => times(i => makeComment(db, post, i), count)
db.action(async () => {
await db.unsafeResetDatabase()
const blogs = times(i => makeBlog(db, i), blogCount)
const posts = flatMap(blog => makePosts(db, blog, fuzzCount(postsPerBlog)), blogs)
const comments = flatMap(post => makeComments(db, post, fuzzCount(commentsPerPost)), posts)
const allRecords = [...blogs, ...posts, ...comments]
await db.batch(...allRecords)
return allRecords.length
})