|
|
@ -3,7 +3,7 @@ var isObject = require('is-object'); |
|
|
|
// validate inputs, convert types and apply defaults
|
|
|
|
// validate inputs, convert types and apply defaults
|
|
|
|
function sanitize( req, default_value ){ |
|
|
|
function sanitize( req, default_value ){ |
|
|
|
|
|
|
|
|
|
|
|
var clean = req.clean || {}; |
|
|
|
req.clean = req.clean || {}; |
|
|
|
var params= req.query; |
|
|
|
var params= req.query; |
|
|
|
|
|
|
|
|
|
|
|
if (default_value === undefined) { |
|
|
|
if (default_value === undefined) { |
|
|
@ -17,14 +17,12 @@ function sanitize( req, default_value ){ |
|
|
|
params = {}; |
|
|
|
params = {}; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (params.details !== undefined) { |
|
|
|
if (params.details === undefined) { |
|
|
|
clean.details = isTruthy(params.details); |
|
|
|
req.clean.details = default_value; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
clean.details = default_value; |
|
|
|
req.clean.details = isTruthy(params.details); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
req.clean = clean; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return {'error':false}; |
|
|
|
return {'error':false}; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|