aboutsummaryrefslogblamecommitdiffhomepage
path: root/server/helpers/custom-validators/pods.js
blob: 40f8b5d0b895f4ad8819a0625f14c3727d98113d (plain) (tree)
1
2
3
4
5
6
7
8






                                                        
                      












                                                                                
'use strict'

const validator = require('express-validator').validator

const miscValidators = require('./misc')

const podsValidators = {
  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