From c45f7f84001c2731909db04dd82e1c1f290386eb Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Sun, 31 Jan 2016 11:23:52 +0100 Subject: Infile code reorganization --- helpers/customValidators.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'helpers/customValidators.js') diff --git a/helpers/customValidators.js b/helpers/customValidators.js index 73c2f8461..c433e5c5d 100644 --- a/helpers/customValidators.js +++ b/helpers/customValidators.js @@ -3,9 +3,13 @@ var validator = require('validator') - var customValidators = {} + var customValidators = { + eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid, + eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid, + isArray: isArray + } - customValidators.eachIsRemoteVideosAddValid = function (values) { + function eachIsRemoteVideosAddValid (values) { return values.every(function (val) { return validator.isLength(val.name, 1, 50) && validator.isLength(val.description, 1, 50) && @@ -14,16 +18,17 @@ }) } - customValidators.eachIsRemoteVideosRemoveValid = function (values) { + function eachIsRemoteVideosRemoveValid (values) { return values.every(function (val) { return validator.isLength(val.magnetUri, 10) }) } - customValidators.isArray = function (value) { + function isArray (value) { return Array.isArray(value) } - // ----------- Export ----------- + // --------------------------------------------------------------------------- + module.exports = customValidators })() -- cgit v1.2.3