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.
23 lines
496 B
23 lines
496 B
var _ = require('lodash'); |
|
|
|
function _sanitize(raw, clean){ |
|
const messages = {errors: [], warnings: []}; |
|
|
|
if(!_.isUndefined(raw.debug) ){ |
|
clean.enableDebug = (typeof raw.debug === 'string') ? isTruthy(raw.debug.toLowerCase()) : isTruthy( raw.debug ); |
|
} |
|
return messages; |
|
} |
|
|
|
function _expected() { |
|
return [{ name: 'debug' }]; |
|
} |
|
|
|
function isTruthy(val) { |
|
return _.includes( ['true', '1', 1, true], val ); |
|
} |
|
|
|
module.exports = () => ({ |
|
sanitize: _sanitize, |
|
expected: _expected |
|
});
|
|
|