Infile code reorganization
[oweals/peertube.git] / helpers / customValidators.js
index 73c2f8461e68ae8ef90baf4fdd8b2d7acb5dcaf6..c433e5c5d92532b0ab77fdef4e400e9c6657548a 100644 (file)
@@ -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) &&
     })
   }
 
-  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
 })()