diff options
Diffstat (limited to 'server/helpers/custom-validators/misc.js')
-rw-r--r-- | server/helpers/custom-validators/misc.js | 11 |
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 | ||
3 | const validator = require('express-validator').validator | ||
4 | |||
3 | const miscValidators = { | 5 | const miscValidators = { |
4 | exists: exists, | 6 | exists: exists, |
5 | isArray: isArray | 7 | isArray: isArray, |
8 | isEachUrl: isEachUrl | ||
6 | } | 9 | } |
7 | 10 | ||
8 | function exists (value) { | 11 | function exists (value) { |
@@ -13,6 +16,12 @@ function isArray (value) { | |||
13 | return Array.isArray(value) | 16 | return Array.isArray(value) |
14 | } | 17 | } |
15 | 18 | ||
19 | function isEachUrl (urls) { | ||
20 | return urls.every(function (url) { | ||
21 | return validator.isURL(url) | ||
22 | }) | ||
23 | } | ||
24 | |||
16 | // --------------------------------------------------------------------------- | 25 | // --------------------------------------------------------------------------- |
17 | 26 | ||
18 | module.exports = miscValidators | 27 | module.exports = miscValidators |