]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blob - 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
1 'use strict'
2
3 const validator = require('express-validator').validator
4
5 const miscValidators = {
6 exists: exists,
7 isArray: isArray,
8 isEachUrl: isEachUrl
9 }
10
11 function exists (value) {
12 return value !== undefined && value !== null
13 }
14
15 function isArray (value) {
16 return Array.isArray(value)
17 }
18
19 function isEachUrl (urls) {
20 return urls.every(function (url) {
21 return validator.isURL(url)
22 })
23 }
24
25 // ---------------------------------------------------------------------------
26
27 module.exports = miscValidators