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
657 B
18 lines
657 B
const _ = require('lodash'); |
|
const Debug = require('../../helper/debug'); |
|
const debugLog = new Debug('controller:predicates:is_admin_only_analysis'); |
|
|
|
module.exports = (request, response) => { |
|
if (!request.clean.hasOwnProperty('parsed_text')) { |
|
debugLog.push(request, false + '(no parsed_text)'); |
|
return false; |
|
} |
|
|
|
// return true only if all non-admin properties of parsed_text are empty |
|
const is_admin_only_analysis = ['number', 'street', 'query', 'category', 'postalcode'].every((prop) => { |
|
return _.isEmpty(request.clean.parsed_text[prop]); |
|
}); |
|
|
|
debugLog.push(request, is_admin_only_analysis); |
|
return is_admin_only_analysis; |
|
};
|
|
|