forked from dominictarr/random-name
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
28 lines (22 loc) · 630 Bytes
/
index.js
File metadata and controls
28 lines (22 loc) · 630 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
var names = require('./names.json')
var first = require('./first-names.json')
var middle = require('./middle-names.json')
var place = require('./places.json')
function r(names) {
return function () {
return names[~~(Math.random()*names.length)]
}
}
var random = module.exports = function () {
return random.first() + ' ' +random.last()
}
random.first = r(first)
random.last = r(names)
random.middle = r(middle)
random.place = r(place)
if(!module.parent) {
var l = process.argv[2] || 10
while (l--)
console.log(random.first(), '.', random.middle(), '.', random.last()
, ',', random.place())
}