-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgroups.js
More file actions
32 lines (27 loc) · 905 Bytes
/
groups.js
File metadata and controls
32 lines (27 loc) · 905 Bytes
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
30
31
32
import { names } from "./marvel";
import * as scmClient from "./scm";
import { people } from "./people";
import { adjectives } from "./adjectives";
import {createUsername} from "./users";
const createGroup = name => {
const person = pickRandom(people);
const adjective = pickRandom(adjectives) +'_' + name + "-Group";
let members = new Array();
for (let i = 0; i < 10; i++) {
members.push(createUsername(names[Math.floor(Math.random() * names.length)]));
};
return {
name: adjective,
description: `This group is founded by the following person: ${person.description}`,
members: members
};
};
const pickRandom = (array) => {
return array[Math.floor(Math.random() * array.length)];
};
export const createGroups = () => {
for (let name of names) {
const group = createGroup(name);
scmClient.createGroup(group);
}
};