aboutsummaryrefslogtreecommitdiffhomepage
path: root/helpers/customValidators.js
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-01-30 17:05:22 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-01-30 17:05:22 +0100
commitcda021079ff455cc0fd0eb95a5395fa808ab63d1 (patch)
tree056716de7460462b74b861051a5e9da6e2633fce /helpers/customValidators.js
parent86435b9baedfe300a28ea4545511c1b50d4119f6 (diff)
downloadPeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.tar.gz
PeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.tar.zst
PeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.zip
New directory organization
Diffstat (limited to 'helpers/customValidators.js')
-rw-r--r--helpers/customValidators.js29
1 files changed, 29 insertions, 0 deletions
diff --git a/helpers/customValidators.js b/helpers/customValidators.js
new file mode 100644
index 000000000..73c2f8461
--- /dev/null
+++ b/helpers/customValidators.js
@@ -0,0 +1,29 @@
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})()