Browse Source

added helpful comments

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

12
controller/predicates/has_results_at_layers.js

@ -2,12 +2,11 @@ const _ = require('lodash');
const Debug = require('../../helper/debug');
const debugLog = new Debug('controller:predicates:has_results_at_layers');
const stackTraceLine = require('../../helper/stackTraceLine');
// returns a function that returns true if any result.layer is in any of the
// supplied layers using array intersection
// example usage: determining if the response contains only admin results
module.exports = {
// returns a function that returns true if any result.layer is in any of the
// supplied layers using array intersection
// example usage: determining if the response contains only admin results
any(layers) {
return (request, response) => {
const has_results_at_any_layer = !_.isEmpty(
@ -23,9 +22,12 @@ module.exports = {
stack_trace: stackTraceLine()
}));
return has_results_at_any_layer;
};
},
// returns a function that returns true IFF the layers in all the results are
// in the supplied layers
// example usage: determining if all results are either neighbourhoods or localities
all(layers) {
return (request, response) => {
const has_results_at_all_layers = _.isEmpty(

Loading…
Cancel
Save