-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrandom-author.ts
More file actions
36 lines (34 loc) · 1.18 KB
/
Copy pathrandom-author.ts
File metadata and controls
36 lines (34 loc) · 1.18 KB
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
33
34
35
36
const firstNames = [
'John',
'Emily',
'Michael',
'Sarah',
'David',
'Jessica',
'Robert',
'Jennifer',
'William',
'Elizabeth',
];
const lastNames = ['Smith', 'Johnson', 'Brown', 'Davis', 'Miller', 'Wilson', 'Moore', 'Taylor', 'Anderson', 'Thomas'];
const companies = [
{ name: 'TechCo', location: 'San Francisco' },
{ name: 'InnovateCorp', location: 'New York' },
{ name: 'DataTech', location: 'Los Angeles' },
{ name: 'ConnectX', location: 'Seattle' },
{ name: 'AlphaSoft', location: 'Chicago' },
{ name: 'ByteSys', location: 'Austin' },
{ name: 'NexGen', location: 'Boston' },
{ name: 'FusionTech', location: 'Atlanta' },
{ name: 'EcoSolutions', location: 'Denver' },
{ name: 'GlobalSoft', location: 'Miami' },
];
const getRandomAuthor = () => {
const firstName = firstNames[Math.floor(Math.random() * firstNames.length)];
const lastName = lastNames[Math.floor(Math.random() * lastNames.length)];
const authorName = `${firstName} ${lastName}`;
const companyInfo = companies[Math.floor(Math.random() * companies.length)];
const { name, location } = companyInfo;
return { name: authorName, company: `${name}, ${location}` };
};
export default getRandomAuthor;