aboutsummaryrefslogtreecommitdiffhomepage
path: root/helpers/customValidators.js
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/customValidators.js')
-rw-r--r--helpers/customValidators.js15
1 files changed, 10 insertions, 5 deletions
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 @@
3 3
4 var validator = require('validator') 4 var validator = require('validator')
5 5
6 var customValidators = {} 6 var customValidators = {
7 eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid,
8 eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid,
9 isArray: isArray
10 }
7 11
8 customValidators.eachIsRemoteVideosAddValid = function (values) { 12 function eachIsRemoteVideosAddValid (values) {
9 return values.every(function (val) { 13 return values.every(function (val) {
10 return validator.isLength(val.name, 1, 50) && 14 return validator.isLength(val.name, 1, 50) &&
11 validator.isLength(val.description, 1, 50) && 15 validator.isLength(val.description, 1, 50) &&
@@ -14,16 +18,17 @@
14 }) 18 })
15 } 19 }
16 20
17 customValidators.eachIsRemoteVideosRemoveValid = function (values) { 21 function eachIsRemoteVideosRemoveValid (values) {
18 return values.every(function (val) { 22 return values.every(function (val) {
19 return validator.isLength(val.magnetUri, 10) 23 return validator.isLength(val.magnetUri, 10)
20 }) 24 })
21 } 25 }
22 26
23 customValidators.isArray = function (value) { 27 function isArray (value) {
24 return Array.isArray(value) 28 return Array.isArray(value)
25 } 29 }
26 30
27 // ----------- Export ----------- 31 // ---------------------------------------------------------------------------
32
28 module.exports = customValidators 33 module.exports = customValidators
29})() 34})()