If your user are not in a particular order, add to this: don't use an
array if there is no order, but a hash (object).

users = {};

e.g. with adding a user by: users[id] = {|somenewuserdata|};

In that case getting a new user is easy as:

exports.get_user = function(id, func) {
   func(users[id] ? null : "NOT_FOUND", users[id] || null);
}

I wonder, why you need a callback after all? Its not an IO operation
with a delay. If not needed due to overall structure or so, it gets
even simpler:

exports.get_user = function(id) {
   return users[id] || null;
}

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to