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.

21 lines
556 B

/*
Set a focus.lat and focus.lon if specified in pelias config
*/
var _ = require('lodash');
function setup(defaultParameters){
return function setLocationBias(req, res, next){
if (_.isUndefined(req.clean) ||
_.isUndefined(defaultParameters['focus.point.lat']) ||
_.isUndefined(defaultParameters['focus.point.lon'])) {
return next();
}
req.clean['focus.point.lat'] = defaultParameters['focus.point.lat'];
req.clean['focus.point.lon'] = defaultParameters['focus.point.lon'];
next();
};
}
module.exports = setup;