]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - server/helpers/custom-validators/misc.js
Server: make friends urls come from the request instead of the
[github/Chocobozzz/PeerTube.git] / server / helpers / custom-validators / misc.js
CommitLineData
e4c55619
C
1'use strict'
2
1e2564d3
C
3const validator = require('express-validator').validator
4
e4c55619
C
5const miscValidators = {
6 exists: exists,
1e2564d3
C
7 isArray: isArray,
8 isEachUrl: isEachUrl
e4c55619
C
9}
10
11function exists (value) {
12 return value !== undefined && value !== null
13}
14
15function isArray (value) {
16 return Array.isArray(value)
17}
18
1e2564d3
C
19function isEachUrl (urls) {
20 return urls.every(function (url) {
21 return validator.isURL(url)
22 })
23}
24
e4c55619
C
25// ---------------------------------------------------------------------------
26
27module.exports = miscValidators