mirror of https://github.com/pelias/api.git
Harish Krishna
10 years ago
17 changed files with 139 additions and 29 deletions
@ -0,0 +1,23 @@
|
||||
// validate inputs, convert types and apply defaults
|
||||
function sanitize( req, default_value ){ |
||||
|
||||
var clean = req.clean || {}; |
||||
var params= req.query; |
||||
|
||||
default_value = !!default_value; |
||||
|
||||
// ensure the input params are a valid object
|
||||
if( Object.prototype.toString.call( params ) !== '[object Object]' ){ |
||||
params = {}; |
||||
} |
||||
|
||||
clean.details = !!params.details; |
||||
|
||||
req.clean = clean; |
||||
|
||||
return {'error':false}; |
||||
|
||||
} |
||||
|
||||
// export function
|
||||
module.exports = sanitize; |
Loading…
Reference in new issue