]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - helpers/customValidators.js
New directory organization
[github/Chocobozzz/PeerTube.git] / helpers / customValidators.js
1 ;(function () {
2 'use strict'
3
4 var validator = require('validator')
5
6 var customValidators = {}
7
8 customValidators.eachIsRemoteVideosAddValid = function (values) {
9 return values.every(function (val) {
10 return validator.isLength(val.name, 1, 50) &&
11 validator.isLength(val.description, 1, 50) &&
12 validator.isLength(val.magnetUri, 10) &&
13 validator.isURL(val.podUrl)
14 })
15 }
16
17 customValidators.eachIsRemoteVideosRemoveValid = function (values) {
18 return values.every(function (val) {
19 return validator.isLength(val.magnetUri, 10)
20 })
21 }
22
23 customValidators.isArray = function (value) {
24 return Array.isArray(value)
25 }
26
27 // ----------- Export -----------
28 module.exports = customValidators
29 })()