From 3d61a1b15bddacc25449d6797e2ed58b6ac0900b Mon Sep 17 00:00:00 2001 From: Baris Soner Usakli Date: Sun, 2 Feb 2014 15:02:27 -0500 Subject: [PATCH] use map instead of eachSeries --- src/user.js | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/src/user.js b/src/user.js index ce012bab2a..b24fe48e64 100644 --- a/src/user.js +++ b/src/user.js @@ -164,25 +164,11 @@ var bcrypt = require('bcryptjs'), return callback(null, []); } - var returnData = []; - - var uuids = uids.filter(function(value, index, self) { - return self.indexOf(value) === index; - }); - - function iterator(uid, next) { - User.getUserFields(uid, fields, function(err, userData) { - if (err) { - return next(err); - } - returnData.push(userData); - next(null); - }); + function getFields(uid, next) { + User.getUserFields(uid, fields, next); } - async.eachSeries(uuids, iterator, function(err) { - callback(err, returnData); - }); + async.map(uids, getFields, callback); }; User.getUserData = function(uid, callback) {