aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators/pods.js
blob: 28d04a05dc02ac2923bca5b2e3c5c9701f663bbf (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'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