1
0
Fork 0
peertube/server/helpers/custom-validators/pods.js
2016-08-21 10:41:04 +02:00

21 lines
527 B
JavaScript

'use strict'
const validator = require('express-validator').validator
const miscValidators = require('./misc')
const podsValidators = {
isEachUniqueUrlValid: isEachUniqueUrlValid
}
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