2016-08-21 04:08:40 -04:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
const validator = require('express-validator').validator
|
|
|
|
|
|
|
|
const miscValidators = require('./misc')
|
|
|
|
|
|
|
|
const podsValidators = {
|
2016-10-02 06:19:02 -04:00
|
|
|
isEachUniqueUrlValid
|
2016-08-21 04:08:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
function isEachUniqueUrlValid (urls) {
|
|
|
|
return miscValidators.isArray(urls) &&
|
|
|
|
urls.length !== 0 &&
|
|
|
|
urls.every(function (url) {
|
|
|
|
return validator.isURL(url) && urls.indexOf(url) === urls.lastIndexOf(url)
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
module.exports = podsValidators
|