2020-04-01 05:07:45 -04:00
|
|
|
let id = 1;
|
|
|
|
|
|
|
|
// Code taken from: https://gist.github.com/6174/6062387
|
|
|
|
const getRandomString = () =>
|
|
|
|
Math.random()
|
|
|
|
.toString(36)
|
|
|
|
.substring(2, 15) +
|
|
|
|
Math.random()
|
|
|
|
.toString(36)
|
|
|
|
.substring(2, 15);
|
|
|
|
|
|
|
|
const getRandomUrl = () => `https://${getRandomString()}.com/${getRandomString()}`;
|
|
|
|
|
2019-03-28 15:07:40 -04:00
|
|
|
export default {
|
|
|
|
createNumberRandomUsers(numberUsers) {
|
|
|
|
const users = [];
|
|
|
|
for (let i = 0; i < numberUsers; i += 1) {
|
|
|
|
users.push({
|
2020-04-01 05:07:45 -04:00
|
|
|
avatar_url: getRandomUrl(),
|
|
|
|
id: id + 1,
|
|
|
|
name: getRandomString(),
|
|
|
|
username: getRandomString(),
|
|
|
|
user_path: getRandomUrl(),
|
2019-03-28 15:07:40 -04:00
|
|
|
});
|
2020-04-01 05:07:45 -04:00
|
|
|
|
|
|
|
id += 1;
|
2019-03-28 15:07:40 -04:00
|
|
|
}
|
|
|
|
return users;
|
|
|
|
},
|
2020-04-01 05:07:45 -04:00
|
|
|
|
|
|
|
createRandomUser() {
|
|
|
|
return this.createNumberRandomUsers(1)[0];
|
|
|
|
},
|
2019-03-28 15:07:40 -04:00
|
|
|
};
|