Open History to see the last commit
1import { faker } from '@faker-js/faker'
2β
3export type Sale = {
4 category: string
5 item: string
6 amount: number
7 score: number
8}
9β
10const categories = ['Hardware', 'Software', 'Services'] as const
11β
12const newSale = (): Sale => ({
13 category: faker.helpers.arrayElement(categories),
14 item: faker.commerce.productName(),
15 amount: faker.number.int({ min: 25, max: 5_000 }),
16 score: faker.number.int({ min: 60, max: 100 }),
17})
18β
19export function makeData(length: number): Array<Sale> {
20 return Array.from({ length }, newSale)
21}