-
Notifications
You must be signed in to change notification settings - Fork 38
/
generator.js
29 lines (24 loc) · 1.04 KB
/
generator.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const crypto = require('crypto');
const COLORS = [
"Red", "Green", "Blue", "Yellow", "Orange", "Purple", "Pink", "Brown",
"Black", "White", "Gray", "Silver", "Gold", "Cyan", "Magenta", "Maroon",
"Navy", "Olive", "Teal", "Aqua", "Lime", "Coral", "Aquamarine",
"Turquoise", "Violet", "Indigo", "Plum", "Crimson", "Salmon", "Coral",
"Khaki", "Beige",
];
const PRODUCTS = [
"Shoes", "Sweatshirts", "Hats", "Pants", "Shirts", "T-Shirts", "Trousers",
"Jackets", "Shorts", "Skirts", "Dresses", "Coats", "Jeans", "Blazers",
"Socks", "Gloves", "Belts", "Bags", "Shoes", "Sunglasses", "Watches",
"Jewelry", "Ties", "Hair Accessories", "Makeup", "Accessories",
];
module.exports = {
generateProduct: function (context, events, done) {
const color = COLORS[Math.floor(Math.random() * COLORS.length)];
const name = PRODUCTS[Math.floor(Math.random() * PRODUCTS.length)];
context.vars.id = crypto.randomUUID();
context.vars.name = `${color} ${name}`;
context.vars.price = Math.round(Math.random() * 10000) / 100;
return done();
},
};