5 function User(name
, age
, species
) {
8 this.species
= species
;
11 User
.all = function(fn
){
12 // process.nextTick makes sure this function API
13 // behaves in an asynchronous manner, like if it
14 // was a real DB query to read all users.
15 process
.nextTick(function(){
20 User
.count = function(fn
){
21 process
.nextTick(function(){
22 fn(null, users
.length
);
30 users
.push(new User('Tobi', 2, 'ferret'));
31 users
.push(new User('Loki', 1, 'ferret'));
32 users
.push(new User('Jane', 6, 'ferret'));
33 users
.push(new User('Luna', 1, 'cat'));
34 users
.push(new User('Manny', 1, 'cat'));