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

@@ -268,7 +268,7 @@ function getCategoryData(cids, uid, selectedCid, callback) {
var selectedCategory = [];
var selectedCids = [];
categoryData.forEach(function (category) {
category.selected = selectedCid ? selectedCid.indexOf(String(category.cid)) !== -1 : false;
category.selected = selectedCid ? selectedCid.includes(String(category.cid)) : false;
category.parentCid = category.hasOwnProperty('parentCid') && utils.isNumber(category.parentCid) ? category.parentCid : 0;
if (category.selected) {
selectedCategory.push(category);