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
570 B
18 lines
570 B
7 years ago
|
const _ = require('lodash');
|
||
|
const Debug = require('../../helper/debug');
|
||
|
const debugLog = new Debug('controller:predicates:is_request_sources_only_whosonfirst');
|
||
|
const stackTraceLine = require('../../helper/stackTraceLine');
|
||
|
|
||
|
// returns true IFF req.clean.parsed_text contains exactly 1 field
|
||
|
module.exports = (req, res) => {
|
||
|
const is_single_field_analysis = _.keys(_.get(req, ['clean', 'parsed_text'])).length === 1;
|
||
|
|
||
|
debugLog.push(req, () => ({
|
||
|
reply: is_single_field_analysis,
|
||
|
stack_trace: stackTraceLine()
|
||
|
}));
|
||
|
|
||
|
return is_single_field_analysis;
|
||
|
|
||
|
};
|