2020-04-22 19:07:51 +05:30
|
|
|
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-07-07 11:18:12 +05:30
|
|
|
export default {
|
|
|
|
createNumberRandomUsers(numberUsers) {
|
|
|
|
const users = [];
|
|
|
|
for (let i = 0; i < numberUsers; i += 1) {
|
|
|
|
users.push({
|
2020-04-22 19:07:51 +05:30
|
|
|
avatar_url: getRandomUrl(),
|
|
|
|
id: id + 1,
|
|
|
|
name: getRandomString(),
|
|
|
|
username: getRandomString(),
|
|
|
|
user_path: getRandomUrl(),
|
2019-07-07 11:18:12 +05:30
|
|
|
});
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
id += 1;
|
2019-07-07 11:18:12 +05:30
|
|
|
}
|
|
|
|
return users;
|
|
|
|
},
|
2020-04-22 19:07:51 +05:30
|
|
|
|
|
|
|
createRandomUser() {
|
|
|
|
return this.createNumberRandomUsers(1)[0];
|
|
|
|
},
|
2019-07-07 11:18:12 +05:30
|
|
|
};
|