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