aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/misc.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/misc.js b/server/helpers/custom-validators/misc.js
index 782ae3dee..13904ea1b 100644
--- a/server/helpers/custom-validators/misc.js
+++ b/server/helpers/custom-validators/misc.js
@@ -1,8 +1,11 @@
1'use strict' 1'use strict'
2 2
3const validator = require('express-validator').validator
4
3const miscValidators = { 5const miscValidators = {
4 exists: exists, 6 exists: exists,
5 isArray: isArray 7 isArray: isArray,
8 isEachUrl: isEachUrl
6} 9}
7 10
8function exists (value) { 11function exists (value) {
@@ -13,6 +16,12 @@ function isArray (value) {
13 return Array.isArray(value) 16 return Array.isArray(value)
14} 17}
15 18
19function isEachUrl (urls) {
20 return urls.every(function (url) {
21 return validator.isURL(url)
22 })
23}
24
16// --------------------------------------------------------------------------- 25// ---------------------------------------------------------------------------
17 26
18module.exports = miscValidators 27module.exports = miscValidators