From 11b5a1f4263f2b008e2befc8d333a8abcd67d57b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 16 Sep 2016 02:24:59 +0300 Subject: [PATCH] simplify map --- src/controllers/admin/flags.js | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/controllers/admin/flags.js b/src/controllers/admin/flags.js index 4192372163..54a52aa319 100644 --- a/src/controllers/admin/flags.js +++ b/src/controllers/admin/flags.js @@ -39,16 +39,10 @@ flagsController.get = function(req, res, next) { // Minimise data set for assignees so tjs does less work results.assignees = results.assignees.map(function(userObj) { - var keep = ['uid', 'username']; - for(var prop in userObj) { - if (userObj.hasOwnProperty(prop)) { - if (keep.indexOf(prop) === -1) { - delete userObj[prop]; - } - } - } - - return userObj; + return { + uid: userObj.uid, + username: userObj.username + }; }); var pageCount = Math.max(1, Math.ceil(results.flagData.count / itemsPerPage));