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 // 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};
} }

Loading…
Cancel
Save