mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 02:09:37 +02:00
Prepare folders structure for angular app
This commit is contained in:
parent
b2ff5e3e68
commit
b9a3e09ad5
60 changed files with 13 additions and 86 deletions
32
server/helpers/customValidators.js
Normal file
32
server/helpers/customValidators.js
Normal file
|
@ -0,0 +1,32 @@
|
|||
'use strict'
|
||||
|
||||
var validator = require('validator')
|
||||
|
||||
var customValidators = {
|
||||
eachIsRemoteVideosAddValid: eachIsRemoteVideosAddValid,
|
||||
eachIsRemoteVideosRemoveValid: eachIsRemoteVideosRemoveValid,
|
||||
isArray: isArray
|
||||
}
|
||||
|
||||
function eachIsRemoteVideosAddValid (values) {
|
||||
return values.every(function (val) {
|
||||
return validator.isLength(val.name, 1, 50) &&
|
||||
validator.isLength(val.description, 1, 50) &&
|
||||
validator.isLength(val.magnetUri, 10) &&
|
||||
validator.isURL(val.podUrl)
|
||||
})
|
||||
}
|
||||
|
||||
function eachIsRemoteVideosRemoveValid (values) {
|
||||
return values.every(function (val) {
|
||||
return validator.isLength(val.magnetUri, 10)
|
||||
})
|
||||
}
|
||||
|
||||
function isArray (value) {
|
||||
return Array.isArray(value)
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
module.exports = customValidators
|
Loading…
Add table
Add a link
Reference in a new issue