Browse Source

use shorter function syntax

query-for-venues-on-admin-only
Stephen Hess 7 years ago
parent
commit
53268cf337
  1. 9
      controller/predicates/has_results_at_layers.js

9
controller/predicates/has_results_at_layers.js

@ -8,7 +8,8 @@ const stackTraceLine = require('../../helper/stackTraceLine');
// example usage: determining if the response contains only admin results // example usage: determining if the response contains only admin results
module.exports = { module.exports = {
any: (layers) => (request, response) => { any(layers) {
return (request, response) => {
const has_results_at_any_layer = !_.isEmpty( const has_results_at_any_layer = !_.isEmpty(
_.intersection( _.intersection(
// convert layers to an array if it isn't already one // convert layers to an array if it isn't already one
@ -22,9 +23,10 @@ module.exports = {
stack_trace: stackTraceLine() stack_trace: stackTraceLine()
})); }));
return has_results_at_any_layer; return has_results_at_any_layer;
};
}, },
all: (layers) => (request, response) => { all(layers) {
return (request, response) => {
const has_results_at_all_layers = _.isEmpty( const has_results_at_all_layers = _.isEmpty(
_.difference( _.difference(
_.map(response.data, _.property('layer')), _.map(response.data, _.property('layer')),
@ -38,6 +40,7 @@ module.exports = {
})); }));
return has_results_at_all_layers; return has_results_at_all_layers;
};
} }
}; };

Loading…
Cancel
Save