use includes instead of indexOf

use _.uniq instead of filter&indexOf
This commit is contained in:
Barış Soner Uşaklı
2018-10-20 14:40:48 -04:00
parent a6c70412db
commit 26d4e0852f
57 changed files with 156 additions and 208 deletions

View File

@@ -121,11 +121,7 @@ module.exports = function (Categories) {
topic.teaserPid = topic.teaserPid || topic.mainPid;
}
});
var cids = _topicData.map(function (topic) {
return topic && topic.cid;
}).filter(function (cid, index, array) {
return cid && array.indexOf(cid) === index;
});
var cids = _.uniq(topicData.map(topic => topic && topic.cid).filter(cid => parseInt(cid, 10)));
async.parallel({
categoryData: async.apply(Categories.getCategoriesFields, cids, ['cid', 'parentCid']),