From c458eabf9b2a38dc6c4f0c0606e69baf83264cfa Mon Sep 17 00:00:00 2001 From: Lily He Date: Thu, 20 Jul 2017 14:52:20 -0400 Subject: [PATCH] delete unused _details sanitizer --- sanitizer/_details.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 sanitizer/_details.js diff --git a/sanitizer/_details.js b/sanitizer/_details.js deleted file mode 100644 index c67f7c47..00000000 --- a/sanitizer/_details.js +++ /dev/null @@ -1,32 +0,0 @@ - -var _ = require('lodash'), - check = require('check-types'); - -var DEFAULT_DETAILS_BOOL = true; - -// validate inputs, convert types and apply defaults -function sanitize( raw, clean ){ - - // error & warning messages - var messages = { errors: [], warnings: [] }; - - if( !check.undefined( raw.details ) ){ - clean.details = isTruthy( raw.details ); - } else { - clean.details = DEFAULT_DETAILS_BOOL; - } - - return messages; -} - -// be lenient with 'truthy' values -function isTruthy(val) { - if( check.string( val ) ){ - return _.includes( ['true', '1'], val ); - } - - return val === 1 || val === true; -} - -// export function -module.exports = sanitize;