]>
Commit | Line | Data |
---|---|---|
d57d6f26 C |
1 | 'use strict' |
2 | ||
3 | const validator = require('express-validator').validator | |
4 | ||
5 | const miscValidators = require('./misc') | |
6 | ||
7 | const podsValidators = { | |
49abbbbe | 8 | isEachUniqueHostValid |
d57d6f26 C |
9 | } |
10 | ||
49abbbbe C |
11 | function isEachUniqueHostValid (hosts) { |
12 | return miscValidators.isArray(hosts) && | |
13 | hosts.length !== 0 && | |
14 | hosts.every(function (host) { | |
15 | return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host) | |
d57d6f26 C |
16 | }) |
17 | } | |
18 | ||
19 | // --------------------------------------------------------------------------- | |
20 | ||
21 | module.exports = podsValidators |