Browse Source

refactored _details sanitizer

removed redundant variable
swapped conditionals for readability
pull/248/head
Stephen Hess 9 years ago
parent
commit
728fa8ac46
  1. 10
      sanitiser/_details.js

10
sanitiser/_details.js

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

Loading…
Cancel
Save