|
|
@ -2,12 +2,11 @@ const _ = require('lodash'); |
|
|
|
const Debug = require('../../helper/debug'); |
|
|
|
const Debug = require('../../helper/debug'); |
|
|
|
const debugLog = new Debug('controller:predicates:has_results_at_layers'); |
|
|
|
const debugLog = new Debug('controller:predicates:has_results_at_layers'); |
|
|
|
const stackTraceLine = require('../../helper/stackTraceLine'); |
|
|
|
const stackTraceLine = require('../../helper/stackTraceLine'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
// returns a function that returns true if any result.layer is in any of the
|
|
|
|
// returns a function that returns true if any result.layer is in any of the
|
|
|
|
// supplied layers using array intersection
|
|
|
|
// supplied layers using array intersection
|
|
|
|
|
|
|
|
|
|
|
|
// example usage: determining if the response contains only admin results
|
|
|
|
// example usage: determining if the response contains only admin results
|
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
|
|
|
|
any(layers) { |
|
|
|
any(layers) { |
|
|
|
return (request, response) => { |
|
|
|
return (request, response) => { |
|
|
|
const has_results_at_any_layer = !_.isEmpty( |
|
|
|
const has_results_at_any_layer = !_.isEmpty( |
|
|
@ -26,6 +25,9 @@ module.exports = { |
|
|
|
|
|
|
|
|
|
|
|
}; |
|
|
|
}; |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
// 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) { |
|
|
|
all(layers) { |
|
|
|
return (request, response) => { |
|
|
|
return (request, response) => { |
|
|
|
const has_results_at_all_layers = _.isEmpty( |
|
|
|
const has_results_at_all_layers = _.isEmpty( |
|
|
|