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.
17 lines
296 B
17 lines
296 B
10 years ago
|
function sanitize( req, sanitiser, cb ){
|
||
|
|
||
|
req.clean = req.clean || {};
|
||
|
|
||
|
for (var s in sanitiser) {
|
||
|
var sanity = sanitiser[s](req);
|
||
|
if (sanity.error) {
|
||
|
return cb(sanity.message);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return cb( undefined, req.clean );
|
||
|
|
||
|
}
|
||
|
|
||
|
// export function
|
||
|
module.exports = sanitize;
|