]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - 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
index 782ae3dee5f6e5af572370e6c8a6d0596a3cd1b0..13904ea1b1faa5d1c1998be0e539942bda5704cf 100644 (file)
@@ -1,8 +1,11 @@
 'use strict'
 
+const validator = require('express-validator').validator
+
 const miscValidators = {
   exists: exists,
-  isArray: isArray
+  isArray: isArray,
+  isEachUrl: isEachUrl
 }
 
 function exists (value) {
@@ -13,6 +16,12 @@ function isArray (value) {
   return Array.isArray(value)
 }
 
+function isEachUrl (urls) {
+  return urls.every(function (url) {
+    return validator.isURL(url)
+  })
+}
+
 // ---------------------------------------------------------------------------
 
 module.exports = miscValidators