Skip to content

Commit 32b50fb

Browse files
committed
adding semi_random_users.coffee example
1 parent 4189700 commit 32b50fb

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

examples/semi_random_users.coffee

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
random = require '../lib/RandomData'
2+
3+
randomUser = (n) ->
4+
login: "user#{n}"
5+
password: "password#{n}"
6+
first_name: random.firstName()
7+
middle_initial: random.middleInitial()
8+
last_name: random.lastName()
9+
address_line_1: random.addressLine1()
10+
address_line_2: random.addressLine2()
11+
city: random.city()
12+
state: random.usStateName()
13+
zip: random.usZipLong()
14+
home_phone: random.usPhone()
15+
cell_phone: random.usPhone()
16+
17+
if process.argv.length != 3
18+
console.log "random_users.coffee: Generate random user data."
19+
console.log "Usage: coffee [ NUM_USERS ]"
20+
process.exit 1
21+
22+
num_users = (Number) process.argv[2]
23+
24+
users = (randomUser(i) for i in [1..num_users])
25+
console.log users
26+

0 commit comments

Comments
 (0)