From 728fa8ac46ccd01c9702d22c7cb686e6f4601cfc Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Thu, 10 Sep 2015 17:06:20 -0400 Subject: [PATCH] refactored _details sanitizer removed redundant variable swapped conditionals for readability --- sanitiser/_details.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/sanitiser/_details.js b/sanitiser/_details.js index 3a1e734a..8bd56ecb 100644 --- a/sanitiser/_details.js +++ b/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}; }