ESlint n-loop-func, yoda

This commit is contained in:
Peter Jaszkowiak
2017-02-18 14:00:29 -07:00
parent 04bb6513b0
commit a0a50677da
6 changed files with 21 additions and 22 deletions

View File

@@ -204,16 +204,15 @@ function ignoreOrWatch(fn, socket, cid, callback) {
// filter to subcategories of cid
var any = true;
while (any) {
any = false;
categoryData.forEach(function (c) {
if (cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1) {
cids.push(c.cid);
any = true;
}
var cat;
do {
cat = categoryData.find(function (c) {
return cids.indexOf(c.cid) === -1 && cids.indexOf(c.parentCid) !== -1;
});
}
if (cat) {
cids.push(cat.cid);
}
} while (cat);
async.each(cids, function (cid, next) {
fn(socket.uid, cid, next);