-
Notifications
You must be signed in to change notification settings - Fork 1
/
tweetBank.js
36 lines (27 loc) · 1.15 KB
/
tweetBank.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
30
31
32
33
34
35
var _= require('lodash')
var data =[];
function add (name, content) {
data.push({ name: name, content: content ,id : Math.floor(Math.random() *124456857383)});
}
function list () {
return _.cloneDeep(data);
}
function find (properties) {
return _.cloneDeep(_.filter(data, properties));
}
var randArrayEl = function(arr) {
return arr[Math.floor(Math.random() * arr.length)];
};
var getFakeName = function() {
var fakeFirsts = ['Nimit', 'Dave', 'Shanna', 'Charlotte', 'Scott', 'Ayana', 'Omri', 'Gabriel', 'Joe'];
var fakeLasts = ['Hashington', 'Stackson', 'McQueue', 'OLogn', 'Ternary', 'Claujure', 'Dunderproto', 'Binder', 'Docsreader', 'Ecma'];
return randArrayEl(fakeFirsts) + " " + randArrayEl(fakeLasts);
};
var getFakeTweet = function() {
var awesome_adj = ['awesome', 'breathtaking', 'amazing', 'funny', 'sweet', 'cool', 'wonderful', 'mindblowing'];
return "Fullstack Academy is " + randArrayEl(awesome_adj) + "! The instructors are just so " + randArrayEl(awesome_adj) + ". #fullstacklove #codedreams";
};
module.exports = { add: add, list: list, find: find };
for (var i = 0; i < 10; i++) {
module.exports.add( getFakeName(), getFakeTweet() );
}