From 3d33c21cc81754ef820a74bbd3eaf34cca78fb2e Mon Sep 17 00:00:00 2001 From: Daniel Herrero Date: Thu, 9 Nov 2017 08:59:40 +0100 Subject: [PATCH] removed eslint errors --- services/loopback/common/models/vn-model.js | 30 ++++++++++++--------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/services/loopback/common/models/vn-model.js b/services/loopback/common/models/vn-model.js index 72605a808..3305cb67d 100644 --- a/services/loopback/common/models/vn-model.js +++ b/services/loopback/common/models/vn-model.js @@ -45,18 +45,20 @@ module.exports = function(Self) { }); this.list = function(ctx, clientFilter, cb) { - var clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : []; - var serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : []; - var fields = clientFields.filter(itemC => { + let clientFields = (clientFilter && clientFilter.fields) ? clientFilter.fields : []; + let serverFields = (serverFilter && serverFilter.fields) ? serverFilter.fields : []; + let fields = clientFields.filter(itemC => { return serverFields.some(itemS => itemS === itemC); }); + let and = []; + let order; + let limit; + let filter = {order: order, limit: limit}; - var and = []; - (clientFilter && clientFilter.where) && and.push(clientFilter.where); - (serverFilter && serverFilter.where) && and.push(serverFilter.where); - - var order; - var limit; + if (clientFilter && clientFilter.where) + and.push(clientFilter.where); + if (serverFilter && serverFilter.where) + and.push(serverFilter.where); if (clientFilter && clientFilter.order) order = clientFilter.order; @@ -68,12 +70,14 @@ module.exports = function(Self) { else if (clientFilter && clientFilter.limit) limit = clientFilter.limit; - var filter = {order: order, limit: limit}; filter.where = (and.length > 0) && {and: and}; filter.fields = fields; this.find(filter, function(err, states) { - (err) ? cb(err, null) : cb(null, states); + if (err) + cb(err, null); + else + cb(null, states); }); }; }; @@ -198,8 +202,8 @@ function removeEmpty(o) { let array = []; for (let item of o) { let i = removeEmpty(item); - if (!isEmpty(item)) - array.push(item); + if (!isEmpty(i)) + array.push(i); } if (array.length > 0) return array;