remove more parseInts

This commit is contained in:
Barış Soner Uşaklı
2018-10-23 21:36:00 -04:00
parent a228dc2de9
commit 537b7ff7e8
9 changed files with 25 additions and 38 deletions

View File

@@ -262,9 +262,7 @@ function getCategoryData(cids, uid, selectedCid, callback) {
categories.getCategoriesFields(cids, ['cid', 'name', 'slug', 'icon', 'link', 'color', 'bgColor', 'parentCid', 'image', 'imageClass'], next);
},
function (categoryData, next) {
categoryData = categoryData.filter(function (category) {
return category && !category.link;
});
categoryData = categoryData.filter(category => category && !category.link);
var selectedCategory = [];
var selectedCids = [];
categoryData.forEach(function (category) {
@@ -272,12 +270,10 @@ function getCategoryData(cids, uid, selectedCid, callback) {
category.parentCid = category.hasOwnProperty('parentCid') && utils.isNumber(category.parentCid) ? category.parentCid : 0;
if (category.selected) {
selectedCategory.push(category);
selectedCids.push(parseInt(category.cid, 10));
selectedCids.push(category.cid);
}
});
selectedCids.sort(function (a, b) {
return a - b;
});
selectedCids.sort((a, b) => a - b);
if (selectedCategory.length > 1) {
selectedCategory = {