2016-08-21 10:08:40 +02:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const validator = require('express-validator').validator
|
|
|
|
|
|
|
|
const miscValidators = require('./misc')
|
|
|
|
|
|
|
|
const podsValidators = {
|
2016-11-14 20:03:04 +01:00
|
|
|
isEachUniqueHostValid
|
2016-08-21 10:08:40 +02:00
|
|
|
}
|
|
|
|
|
2016-11-14 20:03:04 +01:00
|
|
|
function isEachUniqueHostValid (hosts) {
|
|
|
|
return miscValidators.isArray(hosts) &&
|
|
|
|
hosts.length !== 0 &&
|
|
|
|
hosts.every(function (host) {
|
|
|
|
return validator.isURL(host) && host.split('://').length === 1 && hosts.indexOf(host) === hosts.lastIndexOf(host)
|
2016-08-21 10:08:40 +02:00
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = podsValidators
|