mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
603 B
18 lines
603 B
8 years ago
|
const _ = require('lodash');
|
||
|
|
||
|
// return true if any setup parameter is a key of request.clean.parsed_text
|
||
|
// "arguments" is only available in long-form function declarations, cannot be shortened to fat arrow syntax
|
||
|
// potential improvement: inject set operator to allow for any/all functionality
|
||
|
module.exports = function() {
|
||
|
// save off requested properties since arguments can't be referenced later
|
||
|
const properties = _.values(arguments);
|
||
|
|
||
|
return (request, response) => !_.isEmpty(
|
||
|
_.intersection(
|
||
|
properties,
|
||
|
_.keys(_.get(request, ['clean', 'parsed_text'], {}))
|
||
|
)
|
||
|
);
|
||
|
|
||
|
};
|